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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

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
Kojto 122:f9eeca106725 5 * @version V1.5.1
Kojto 122:f9eeca106725 6 * @date 31-May-2016
Kojto 122:f9eeca106725 7 * @brief Header file of ADC LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 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) */
Kojto 122:f9eeca106725 74 #define ADC_SQR1_REGOFFSET ((uint32_t)0x00000000U)
Kojto 122:f9eeca106725 75 #define ADC_SQR2_REGOFFSET ((uint32_t)0x00000100U)
Kojto 122:f9eeca106725 76 #define ADC_SQR3_REGOFFSET ((uint32_t)0x00000200U)
Kojto 122:f9eeca106725 77 #define ADC_SQR4_REGOFFSET ((uint32_t)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. */
Kojto 122:f9eeca106725 84 #define ADC_REG_RANK_1_SQRX_BITOFFSET_POS ((uint32_t) 6U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ1) */
Kojto 122:f9eeca106725 85 #define ADC_REG_RANK_2_SQRX_BITOFFSET_POS ((uint32_t)12U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ2) */
Kojto 122:f9eeca106725 86 #define ADC_REG_RANK_3_SQRX_BITOFFSET_POS ((uint32_t)18U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ3) */
Kojto 122:f9eeca106725 87 #define ADC_REG_RANK_4_SQRX_BITOFFSET_POS ((uint32_t)24U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ4) */
Kojto 122:f9eeca106725 88 #define ADC_REG_RANK_5_SQRX_BITOFFSET_POS ((uint32_t) 0U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ5) */
Kojto 122:f9eeca106725 89 #define ADC_REG_RANK_6_SQRX_BITOFFSET_POS ((uint32_t) 6U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ6) */
Kojto 122:f9eeca106725 90 #define ADC_REG_RANK_7_SQRX_BITOFFSET_POS ((uint32_t)12U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ7) */
Kojto 122:f9eeca106725 91 #define ADC_REG_RANK_8_SQRX_BITOFFSET_POS ((uint32_t)18U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ8) */
Kojto 122:f9eeca106725 92 #define ADC_REG_RANK_9_SQRX_BITOFFSET_POS ((uint32_t)24U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ9) */
Kojto 122:f9eeca106725 93 #define ADC_REG_RANK_10_SQRX_BITOFFSET_POS ((uint32_t) 0U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ10) */
Kojto 122:f9eeca106725 94 #define ADC_REG_RANK_11_SQRX_BITOFFSET_POS ((uint32_t) 6U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ11) */
Kojto 122:f9eeca106725 95 #define ADC_REG_RANK_12_SQRX_BITOFFSET_POS ((uint32_t)12U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ12) */
Kojto 122:f9eeca106725 96 #define ADC_REG_RANK_13_SQRX_BITOFFSET_POS ((uint32_t)18U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ13) */
Kojto 122:f9eeca106725 97 #define ADC_REG_RANK_14_SQRX_BITOFFSET_POS ((uint32_t)24U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ14) */
Kojto 122:f9eeca106725 98 #define ADC_REG_RANK_15_SQRX_BITOFFSET_POS ((uint32_t) 0U) /* Value equivalent to POSITION_VAL(ADC_SQR4_SQ15) */
Kojto 122:f9eeca106725 99 #define ADC_REG_RANK_16_SQRX_BITOFFSET_POS ((uint32_t) 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) */
Kojto 122:f9eeca106725 110 #define ADC_JDR1_REGOFFSET ((uint32_t)0x00000000U)
Kojto 122:f9eeca106725 111 #define ADC_JDR2_REGOFFSET ((uint32_t)0x00000100U)
Kojto 122:f9eeca106725 112 #define ADC_JDR3_REGOFFSET ((uint32_t)0x00000200U)
Kojto 122:f9eeca106725 113 #define ADC_JDR4_REGOFFSET ((uint32_t)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. */
Kojto 122:f9eeca106725 120 #define ADC_INJ_RANK_1_JSQR_BITOFFSET_POS ((uint32_t) 8U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ1) */
Kojto 122:f9eeca106725 121 #define ADC_INJ_RANK_2_JSQR_BITOFFSET_POS ((uint32_t)14U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ2) */
Kojto 122:f9eeca106725 122 #define ADC_INJ_RANK_3_JSQR_BITOFFSET_POS ((uint32_t)20U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ3) */
Kojto 122:f9eeca106725 123 #define ADC_INJ_RANK_4_JSQR_BITOFFSET_POS ((uint32_t)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. */
Kojto 122:f9eeca106725 150 #define ADC_REG_TRIG_EXTSEL_BITOFFSET_POS ((uint32_t) 6U) /* Value equivalent to POSITION_VAL(ADC_CFGR_EXTSEL) */
Kojto 122:f9eeca106725 151 #define ADC_REG_TRIG_EXTEN_BITOFFSET_POS ((uint32_t)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. */
Kojto 122:f9eeca106725 178 #define ADC_INJ_TRIG_EXTSEL_BITOFFSET_POS ((uint32_t) 2U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JEXTSEL) */
Kojto 122:f9eeca106725 179 #define ADC_INJ_TRIG_EXTEN_BITOFFSET_POS ((uint32_t) 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)
Kojto 122:f9eeca106725 196 #define ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS ((uint32_t)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 */
Kojto 122:f9eeca106725 202 #define ADC_CHANNEL_ID_INTERNAL_CH ((uint32_t)0x80000000U) /* Marker of internal channel */
Kojto 122:f9eeca106725 203 #define ADC_CHANNEL_ID_INTERNAL_CH_2 ((uint32_t)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) */
Kojto 122:f9eeca106725 208 #define ADC_SMPR1_REGOFFSET ((uint32_t)0x00000000U)
Kojto 122:f9eeca106725 209 #define ADC_SMPR2_REGOFFSET ((uint32_t)0x02000000U)
Kojto 122:f9eeca106725 210 #define ADC_CHANNEL_SMPRX_REGOFFSET_MASK (ADC_SMPR1_REGOFFSET | ADC_SMPR2_REGOFFSET)
Kojto 122:f9eeca106725 211
Kojto 122:f9eeca106725 212 #define ADC_CHANNEL_SMPx_BITOFFSET_MASK ((uint32_t)0x01F00000U)
Kojto 122:f9eeca106725 213 #define ADC_CHANNEL_SMPx_BITOFFSET_POS ((uint32_t)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. */
Kojto 122:f9eeca106725 217 #define ADC_CHANNEL_0_NUMBER ((uint32_t)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. */
Kojto 122:f9eeca106725 261 #define ADC_CHANNEL_0_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t) 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP0) */
Kojto 122:f9eeca106725 262 #define ADC_CHANNEL_1_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t) 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP1) */
Kojto 122:f9eeca106725 263 #define ADC_CHANNEL_2_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t) 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP2) */
Kojto 122:f9eeca106725 264 #define ADC_CHANNEL_3_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t) 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP3) */
Kojto 122:f9eeca106725 265 #define ADC_CHANNEL_4_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP4) */
Kojto 122:f9eeca106725 266 #define ADC_CHANNEL_5_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP5) */
Kojto 122:f9eeca106725 267 #define ADC_CHANNEL_6_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP6) */
Kojto 122:f9eeca106725 268 #define ADC_CHANNEL_7_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP7) */
Kojto 122:f9eeca106725 269 #define ADC_CHANNEL_8_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)24U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP8) */
Kojto 122:f9eeca106725 270 #define ADC_CHANNEL_9_SMP (ADC_SMPR1_REGOFFSET | (((uint32_t)27U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP9) */
Kojto 122:f9eeca106725 271 #define ADC_CHANNEL_10_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t) 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP10) */
Kojto 122:f9eeca106725 272 #define ADC_CHANNEL_11_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t) 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP11) */
Kojto 122:f9eeca106725 273 #define ADC_CHANNEL_12_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t) 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP12) */
Kojto 122:f9eeca106725 274 #define ADC_CHANNEL_13_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t) 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP13) */
Kojto 122:f9eeca106725 275 #define ADC_CHANNEL_14_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t)12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP14) */
Kojto 122:f9eeca106725 276 #define ADC_CHANNEL_15_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t)15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP15) */
Kojto 122:f9eeca106725 277 #define ADC_CHANNEL_16_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t)18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP16) */
Kojto 122:f9eeca106725 278 #define ADC_CHANNEL_17_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t)21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP17) */
Kojto 122:f9eeca106725 279 #define ADC_CHANNEL_18_SMP (ADC_SMPR2_REGOFFSET | (((uint32_t)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 */
Kojto 122:f9eeca106725 304 #define ADC_AWD_CR1_REGOFFSET ((uint32_t)0x00000000U)
Kojto 122:f9eeca106725 305 #define ADC_AWD_CR2_REGOFFSET ((uint32_t)0x00100000U)
Kojto 122:f9eeca106725 306 #define ADC_AWD_CR3_REGOFFSET ((uint32_t)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)
Kojto 122:f9eeca106725 311 #define ADC_AWD_CR12_REGOFFSETGAP_VAL ((uint32_t)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 */
Kojto 122:f9eeca106725 328 #define ADC_OFR1_REGOFFSET ((uint32_t)0x00000000U)
Kojto 122:f9eeca106725 329 #define ADC_OFR2_REGOFFSET ((uint32_t)0x00000001U)
Kojto 122:f9eeca106725 330 #define ADC_OFR3_REGOFFSET ((uint32_t)0x00000002U)
Kojto 122:f9eeca106725 331 #define ADC_OFR4_REGOFFSET ((uint32_t)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 */
Kojto 122:f9eeca106725 336 #define ADC_CFGR_RES_BITOFFSET_POS ((uint32_t) 3U) /* Value equivalent to POSITION_VAL(ADC_CFGR_RES) */
Kojto 122:f9eeca106725 337 #define ADC_CFGR_AWD1SGL_BITOFFSET_POS ((uint32_t)22U) /* Value equivalent to POSITION_VAL(ADC_CFGR_AWD1SGL) */
Kojto 122:f9eeca106725 338 #define ADC_CFGR_AWD1EN_BITOFFSET_POS ((uint32_t)23U) /* Value equivalent to POSITION_VAL(ADC_CFGR_AWD1EN) */
Kojto 122:f9eeca106725 339 #define ADC_CFGR_JAWD1EN_BITOFFSET_POS ((uint32_t)24U) /* Value equivalent to POSITION_VAL(ADC_CFGR_JAWD1EN) */
Kojto 122:f9eeca106725 340 #define ADC_TR1_HT1_BITOFFSET_POS ((uint32_t)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 */
Kojto 122:f9eeca106725 349 #define VREFINT_CAL_ADDR ((uint16_t*) ((uint32_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). */
Kojto 122:f9eeca106725 350 #define VREFINT_CAL_VREF ((uint32_t) 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 */
Kojto 122:f9eeca106725 352 #define TEMPSENSOR_CAL1_ADDR ((uint16_t*) ((uint32_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). */
Kojto 122:f9eeca106725 353 #define TEMPSENSOR_CAL2_ADDR ((uint16_t*) ((uint32_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). */
Kojto 122:f9eeca106725 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). */
Kojto 122:f9eeca106725 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). */
Kojto 122:f9eeca106725 356 #define TEMPSENSOR_CAL_VREFANALOG ((uint32_t) 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(). */
Kojto 122:f9eeca106725 667 #define LL_ADC_DMA_REG_REGULAR_DATA ((uint32_t)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)
Kojto 122:f9eeca106725 669 #define LL_ADC_DMA_REG_REGULAR_DATA_MULTI ((uint32_t)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 */
Kojto 122:f9eeca106725 681 #define LL_ADC_CLOCK_ASYNC_DIV1 ((uint32_t)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. */
Kojto 122:f9eeca106725 705 #define LL_ADC_PATH_INTERNAL_NONE ((uint32_t)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 */
Kojto 122:f9eeca106725 716 #define LL_ADC_RESOLUTION_12B ((uint32_t)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 */
Kojto 122:f9eeca106725 727 #define LL_ADC_DATA_ALIGN_RIGHT ((uint32_t)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 */
Kojto 122:f9eeca106725 736 #define LL_ADC_LP_MODE_NONE ((uint32_t)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 */
Kojto 122:f9eeca106725 756 #define LL_ADC_OFFSET_DISABLE ((uint32_t)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 */
Kojto 122:f9eeca106725 765 #define LL_ADC_GROUP_REGULAR ((uint32_t)0x00000001U) /*!< ADC group regular (available on all STM32 devices) */
Kojto 122:f9eeca106725 766 #define LL_ADC_GROUP_INJECTED ((uint32_t)0x00000002U) /*!< ADC group injected (not available on all STM32 devices)*/
Kojto 122:f9eeca106725 767 #define LL_ADC_GROUP_REGULAR_INJECTED ((uint32_t)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 */
Kojto 122:f9eeca106725 815 #define LL_ADC_REG_TRIG_SOFTWARE ((uint32_t)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 */
Kojto 122:f9eeca106725 849 #define LL_ADC_REG_CONV_SINGLE ((uint32_t)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 */
Kojto 122:f9eeca106725 858 #define LL_ADC_REG_DMA_TRANSFER_NONE ((uint32_t)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
Kojto 122:f9eeca106725 865 /** @defgroup ADC_LL_EC_REG_OVR_DATA_BEHAVIOR ADC group regular - Overrun behavior on conversion data
Kojto 122:f9eeca106725 866 * @{
Kojto 122:f9eeca106725 867 */
Kojto 122:f9eeca106725 868 #define LL_ADC_REG_OVR_DATA_PRESERVED ((uint32_t)0x00000000U)/*!< ADC group regular behavior in case of overrun: data preserved */
Kojto 122:f9eeca106725 869 #define LL_ADC_REG_OVR_DATA_OVERWRITTEN (ADC_CFGR_OVRMOD) /*!< ADC group regular behavior in case of overrun: data overwritten */
Kojto 122:f9eeca106725 870 /**
Kojto 122:f9eeca106725 871 * @}
Kojto 122:f9eeca106725 872 */
Kojto 122:f9eeca106725 873
Kojto 122:f9eeca106725 874 /** @defgroup ADC_LL_EC_REG_SEQ_SCAN_LENGTH ADC group regular - Sequencer scan length
Kojto 122:f9eeca106725 875 * @{
Kojto 122:f9eeca106725 876 */
Kojto 122:f9eeca106725 877 #define LL_ADC_REG_SEQ_SCAN_DISABLE ((uint32_t)0x00000000U) /*!< ADC group regular sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
Kojto 122:f9eeca106725 878 #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 879 #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 880 #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 881 #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 882 #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 883 #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 884 #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 885 #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 886 #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 887 #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 888 #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 889 #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 890 #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 891 #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 892 #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 893 /**
Kojto 122:f9eeca106725 894 * @}
Kojto 122:f9eeca106725 895 */
Kojto 122:f9eeca106725 896
Kojto 122:f9eeca106725 897 /** @defgroup ADC_LL_EC_REG_SEQ_DISCONT_MODE ADC group regular - Sequencer discontinuous mode
Kojto 122:f9eeca106725 898 * @{
Kojto 122:f9eeca106725 899 */
Kojto 122:f9eeca106725 900 #define LL_ADC_REG_SEQ_DISCONT_DISABLE ((uint32_t)0x00000000U) /*!< ADC group regular sequencer discontinuous mode disable */
Kojto 122:f9eeca106725 901 #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 902 #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 903 #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 904 #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 905 #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 906 #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 907 #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 908 #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 909 /**
Kojto 122:f9eeca106725 910 * @}
Kojto 122:f9eeca106725 911 */
Kojto 122:f9eeca106725 912
Kojto 122:f9eeca106725 913 /** @defgroup ADC_LL_EC_REG_SEQ_RANKS ADC group regular - Sequencer ranks
Kojto 122:f9eeca106725 914 * @{
Kojto 122:f9eeca106725 915 */
Kojto 122:f9eeca106725 916 #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 917 #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 918 #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 919 #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 920 #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 921 #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 922 #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 923 #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 924 #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 925 #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 926 #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 927 #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 928 #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 929 #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 930 #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 931 #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 932 /**
Kojto 122:f9eeca106725 933 * @}
Kojto 122:f9eeca106725 934 */
Kojto 122:f9eeca106725 935
Kojto 122:f9eeca106725 936 /** @defgroup ADC_LL_EC_INJ_TRIGGER_SOURCE ADC group injected - Trigger source
Kojto 122:f9eeca106725 937 * @{
Kojto 122:f9eeca106725 938 */
Kojto 122:f9eeca106725 939 #define LL_ADC_INJ_TRIG_SOFTWARE ((uint32_t)0x00000000U) /*!< ADC group injected conversion trigger internal: SW start.. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 940 #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 941 #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 942 #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 943 #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 944 #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 945 #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 946 #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 947 #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 948 #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 949 #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 950 #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 951 #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 952 #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 953 #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 954 #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 955 #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 956 /**
Kojto 122:f9eeca106725 957 * @}
Kojto 122:f9eeca106725 958 */
Kojto 122:f9eeca106725 959
Kojto 122:f9eeca106725 960 /** @defgroup ADC_LL_EC_INJ_TRIGGER_EDGE ADC group injected - Trigger edge
Kojto 122:f9eeca106725 961 * @{
Kojto 122:f9eeca106725 962 */
Kojto 122:f9eeca106725 963 #define LL_ADC_INJ_TRIG_EXT_RISING ( ADC_JSQR_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to rising edge */
Kojto 122:f9eeca106725 964 #define LL_ADC_INJ_TRIG_EXT_FALLING (ADC_JSQR_JEXTEN_1 ) /*!< ADC group injected conversion trigger polarity set to falling edge */
Kojto 122:f9eeca106725 965 #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 966 /**
Kojto 122:f9eeca106725 967 * @}
Kojto 122:f9eeca106725 968 */
Kojto 122:f9eeca106725 969
Kojto 122:f9eeca106725 970 /** @defgroup ADC_LL_EC_INJ_TRIG_AUTO ADC group injected - Automatic trigger mode
Kojto 122:f9eeca106725 971 * @{
Kojto 122:f9eeca106725 972 */
Kojto 122:f9eeca106725 973 #define LL_ADC_INJ_TRIG_INDEPENDENT ((uint32_t)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 974 #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 975 /**
Kojto 122:f9eeca106725 976 * @}
Kojto 122:f9eeca106725 977 */
Kojto 122:f9eeca106725 978
Kojto 122:f9eeca106725 979 /** @defgroup ADC_LL_EC_INJ_CONTEXT_QUEUE ADC group injected - Context queue mode
Kojto 122:f9eeca106725 980 * @{
Kojto 122:f9eeca106725 981 */
Kojto 122:f9eeca106725 982 #define LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE ((uint32_t)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 983 #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 984 #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 985 /**
Kojto 122:f9eeca106725 986 * @}
Kojto 122:f9eeca106725 987 */
Kojto 122:f9eeca106725 988
Kojto 122:f9eeca106725 989 /** @defgroup ADC_LL_EC_INJ_SEQ_SCAN_LENGTH ADC group injected - Sequencer scan length
Kojto 122:f9eeca106725 990 * @{
Kojto 122:f9eeca106725 991 */
Kojto 122:f9eeca106725 992 #define LL_ADC_INJ_SEQ_SCAN_DISABLE ((uint32_t)0x00000000U) /*!< ADC group injected sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
Kojto 122:f9eeca106725 993 #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 994 #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 995 #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 996 /**
Kojto 122:f9eeca106725 997 * @}
Kojto 122:f9eeca106725 998 */
Kojto 122:f9eeca106725 999
Kojto 122:f9eeca106725 1000 /** @defgroup ADC_LL_EC_INJ_SEQ_DISCONT_MODE ADC group injected - Sequencer discontinuous mode
Kojto 122:f9eeca106725 1001 * @{
Kojto 122:f9eeca106725 1002 */
Kojto 122:f9eeca106725 1003 #define LL_ADC_INJ_SEQ_DISCONT_DISABLE ((uint32_t)0x00000000U)/*!< ADC group injected sequencer discontinuous mode disable */
Kojto 122:f9eeca106725 1004 #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 1005 /**
Kojto 122:f9eeca106725 1006 * @}
Kojto 122:f9eeca106725 1007 */
Kojto 122:f9eeca106725 1008
Kojto 122:f9eeca106725 1009 /** @defgroup ADC_LL_EC_INJ_SEQ_RANKS ADC group injected - Sequencer ranks
Kojto 122:f9eeca106725 1010 * @{
Kojto 122:f9eeca106725 1011 */
Kojto 122:f9eeca106725 1012 #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 1013 #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 1014 #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 1015 #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 1016 /**
Kojto 122:f9eeca106725 1017 * @}
Kojto 122:f9eeca106725 1018 */
Kojto 122:f9eeca106725 1019
Kojto 122:f9eeca106725 1020 /** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME Channel - Sampling time
Kojto 122:f9eeca106725 1021 * @{
Kojto 122:f9eeca106725 1022 */
Kojto 122:f9eeca106725 1023 #define LL_ADC_SAMPLINGTIME_2CYCLES_5 (0x00000000U) /*!< Sampling time 2.5 ADC clock cycles */
Kojto 122:f9eeca106725 1024 #define LL_ADC_SAMPLINGTIME_6CYCLES_5 ( ADC_SMPR2_SMP10_0) /*!< Sampling time 6.5 ADC clock cycles */
Kojto 122:f9eeca106725 1025 #define LL_ADC_SAMPLINGTIME_12CYCLES_5 ( ADC_SMPR2_SMP10_1 ) /*!< Sampling time 12.5 ADC clock cycles */
Kojto 122:f9eeca106725 1026 #define LL_ADC_SAMPLINGTIME_24CYCLES_5 ( ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 24.5 ADC clock cycles */
Kojto 122:f9eeca106725 1027 #define LL_ADC_SAMPLINGTIME_47CYCLES_5 (ADC_SMPR2_SMP10_2 ) /*!< Sampling time 47.5 ADC clock cycles */
Kojto 122:f9eeca106725 1028 #define LL_ADC_SAMPLINGTIME_92CYCLES_5 (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_0) /*!< Sampling time 92.5 ADC clock cycles */
Kojto 122:f9eeca106725 1029 #define LL_ADC_SAMPLINGTIME_247CYCLES_5 (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1 ) /*!< Sampling time 247.5 ADC clock cycles */
Kojto 122:f9eeca106725 1030 #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 1031 /**
Kojto 122:f9eeca106725 1032 * @}
Kojto 122:f9eeca106725 1033 */
Kojto 122:f9eeca106725 1034
Kojto 122:f9eeca106725 1035 /** @defgroup ADC_LL_EC_CHANNEL_SINGLE_DIFF_ENDING Channel - Single or differential ending
Kojto 122:f9eeca106725 1036 * @{
Kojto 122:f9eeca106725 1037 */
Kojto 122:f9eeca106725 1038 #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 1039 #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 1040 #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 1041 /**
Kojto 122:f9eeca106725 1042 * @}
Kojto 122:f9eeca106725 1043 */
Kojto 122:f9eeca106725 1044
Kojto 122:f9eeca106725 1045 /** @defgroup ADC_LL_EC_AWD_NUMBER Analog watchdog - Analog watchdog number
Kojto 122:f9eeca106725 1046 * @{
Kojto 122:f9eeca106725 1047 */
Kojto 122:f9eeca106725 1048 #define LL_ADC_AWD1 (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR1_REGOFFSET) /*!< ADC analog watchdog number 1 */
Kojto 122:f9eeca106725 1049 #define LL_ADC_AWD2 (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR2_REGOFFSET) /*!< ADC analog watchdog number 2 */
Kojto 122:f9eeca106725 1050 #define LL_ADC_AWD3 (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR3_REGOFFSET) /*!< ADC analog watchdog number 3 */
Kojto 122:f9eeca106725 1051 /**
Kojto 122:f9eeca106725 1052 * @}
Kojto 122:f9eeca106725 1053 */
Kojto 122:f9eeca106725 1054
Kojto 122:f9eeca106725 1055 /** @defgroup ADC_LL_EC_AWD_CHANNELS Analog watchdog - Monitored channels
Kojto 122:f9eeca106725 1056 * @{
Kojto 122:f9eeca106725 1057 */
Kojto 122:f9eeca106725 1058 #define LL_ADC_AWD_DISABLE ((uint32_t)0x00000000U) /*!< ADC analog watchdog monitoring disabled */
Kojto 122:f9eeca106725 1059 #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 1060 #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 1061 #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 1062 #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 1063 #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 1064 #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 1065 #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 1066 #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 1067 #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 1068 #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 1069 #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 1070 #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 1071 #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 1072 #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 1073 #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 1074 #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 1075 #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 1076 #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 1077 #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 1078 #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 1079 #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 1080 #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 1081 #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 1082 #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 1083 #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 1084 #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 1085 #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 1086 #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 1087 #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 1088 #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 1089 #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 1090 #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 1091 #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 1092 #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 1093 #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 1094 #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 1095 #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 1096 #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 1097 #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 1098 #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 1099 #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 1100 #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 1101 #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 1102 #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 1103 #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 1104 #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 1105 #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 1106 #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 1107 #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 1108 #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 1109 #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 1110 #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 1111 #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 1112 #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 1113 #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 1114 #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 1115 #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 1116 #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 1117 #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 1118 #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 1119 #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 1120 #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 1121 #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 1122 #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 1123 #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 1124 #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 1125 #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 1126 #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 1127 #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 1128 #if defined(ADC1) && !defined(ADC2)
Kojto 122:f9eeca106725 1129 #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 1130 #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 1131 #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 1132 #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 1133 #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 1134 #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 1135 #elif defined(ADC2)
Kojto 122:f9eeca106725 1136 #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 1137 #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 1138 #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 1139 #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 1140 #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 1141 #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 1142 #if defined(ADC3)
Kojto 122:f9eeca106725 1143 #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 1144 #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 1145 #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 1146 #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 1147 #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 1148 #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 1149 #endif
Kojto 122:f9eeca106725 1150 #endif
Kojto 122:f9eeca106725 1151 /**
Kojto 122:f9eeca106725 1152 * @}
Kojto 122:f9eeca106725 1153 */
Kojto 122:f9eeca106725 1154
Kojto 122:f9eeca106725 1155 /** @defgroup ADC_LL_EC_AWD_THRESHOLDS Analog watchdog - Thresholds
Kojto 122:f9eeca106725 1156 * @{
Kojto 122:f9eeca106725 1157 */
Kojto 122:f9eeca106725 1158 #define LL_ADC_AWD_THRESHOLD_HIGH (ADC_TR1_HT1 ) /*!< ADC analog watchdog threshold high */
Kojto 122:f9eeca106725 1159 #define LL_ADC_AWD_THRESHOLD_LOW ( ADC_TR1_LT1) /*!< ADC analog watchdog threshold low */
Kojto 122:f9eeca106725 1160 #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 1161 /**
Kojto 122:f9eeca106725 1162 * @}
Kojto 122:f9eeca106725 1163 */
Kojto 122:f9eeca106725 1164
Kojto 122:f9eeca106725 1165 /** @defgroup ADC_LL_EC_OVS_SCOPE Oversampling - Oversampling scope
Kojto 122:f9eeca106725 1166 * @{
Kojto 122:f9eeca106725 1167 */
Kojto 122:f9eeca106725 1168 #define LL_ADC_OVS_DISABLE ((uint32_t)0x00000000U) /*!< ADC oversampling disabled. */
Kojto 122:f9eeca106725 1169 #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 1170 #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 1171 #define LL_ADC_OVS_GRP_INJECTED ( ADC_CFGR2_JOVSE ) /*!< ADC oversampling on conversions of ADC group injected. */
Kojto 122:f9eeca106725 1172 #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 1173 /**
Kojto 122:f9eeca106725 1174 * @}
Kojto 122:f9eeca106725 1175 */
Kojto 122:f9eeca106725 1176
Kojto 122:f9eeca106725 1177 /** @defgroup ADC_LL_EC_OVS_DISCONT_MODE Oversampling - Discontinuous mode
Kojto 122:f9eeca106725 1178 * @{
Kojto 122:f9eeca106725 1179 */
Kojto 122:f9eeca106725 1180 #define LL_ADC_OVS_REG_CONT ((uint32_t)0x00000000U)/*!< ADC oversampling discontinuous mode: continuous mode (all conversions of oversampling ratio are done from 1 trigger) */
Kojto 122:f9eeca106725 1181 #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 1182 /**
Kojto 122:f9eeca106725 1183 * @}
Kojto 122:f9eeca106725 1184 */
Kojto 122:f9eeca106725 1185
Kojto 122:f9eeca106725 1186 /** @defgroup ADC_LL_EC_OVS_RATIO Oversampling - Ratio
Kojto 122:f9eeca106725 1187 * @{
Kojto 122:f9eeca106725 1188 */
Kojto 122:f9eeca106725 1189 #define LL_ADC_OVS_RATIO_2 ((uint32_t)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 1190 #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 1191 #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 1192 #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 1193 #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 1194 #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 1195 #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 1196 #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 1197 /**
Kojto 122:f9eeca106725 1198 * @}
Kojto 122:f9eeca106725 1199 */
Kojto 122:f9eeca106725 1200
Kojto 122:f9eeca106725 1201 /** @defgroup ADC_LL_EC_OVS_SHIFT Oversampling - Data shift
Kojto 122:f9eeca106725 1202 * @{
Kojto 122:f9eeca106725 1203 */
Kojto 122:f9eeca106725 1204 #define LL_ADC_OVS_SHIFT_NONE ((uint32_t)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 1205 #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 1206 #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 1207 #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 1208 #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 1209 #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 1210 #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 1211 #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 1212 #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 1213 /**
Kojto 122:f9eeca106725 1214 * @}
Kojto 122:f9eeca106725 1215 */
Kojto 122:f9eeca106725 1216
Kojto 122:f9eeca106725 1217 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 1218 /** @defgroup ADC_LL_EC_MULTI_MODE Multimode - Mode
Kojto 122:f9eeca106725 1219 * @{
Kojto 122:f9eeca106725 1220 */
Kojto 122:f9eeca106725 1221 #define LL_ADC_MULTI_INDEPENDENT ((uint32_t)0x00000000U) /*!< ADC dual mode disabled (ADC independent mode) */
Kojto 122:f9eeca106725 1222 #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 1223 #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 1224 #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 1225 #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 1226 #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 1227 #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 1228 #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 1229 /**
Kojto 122:f9eeca106725 1230 * @}
Kojto 122:f9eeca106725 1231 */
Kojto 122:f9eeca106725 1232
Kojto 122:f9eeca106725 1233 /** @defgroup ADC_LL_EC_MULTI_DMA_TRANSFER Multimode - DMA transfer
Kojto 122:f9eeca106725 1234 * @{
Kojto 122:f9eeca106725 1235 */
Kojto 122:f9eeca106725 1236 #define LL_ADC_MULTI_REG_DMA_EACH_ADC ((uint32_t)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 1237 #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 1238 #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 1239 #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 1240 #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 1241 /**
Kojto 122:f9eeca106725 1242 * @}
Kojto 122:f9eeca106725 1243 */
Kojto 122:f9eeca106725 1244
Kojto 122:f9eeca106725 1245 /** @defgroup ADC_LL_EC_MULTI_TWOSMP_DELAY Multimode - Delay between two sampling phases
Kojto 122:f9eeca106725 1246 * @{
Kojto 122:f9eeca106725 1247 */
Kojto 122:f9eeca106725 1248 #define LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE ((uint32_t)0x00000000U) /*!< ADC multimode delay between two sampling phases: 1 ADC clock cycle */
Kojto 122:f9eeca106725 1249 #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 1250 #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 1251 #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 1252 #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 1253 #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 1254 #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 1255 #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 1256 #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 1257 #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 1258 #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 1259 #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 1260 /**
Kojto 122:f9eeca106725 1261 * @}
Kojto 122:f9eeca106725 1262 */
Kojto 122:f9eeca106725 1263
Kojto 122:f9eeca106725 1264 /** @defgroup ADC_LL_EC_MULTI_MASTER_SLAVE Multimode - ADC master or slave
Kojto 122:f9eeca106725 1265 * @{
Kojto 122:f9eeca106725 1266 */
Kojto 122:f9eeca106725 1267 #define LL_ADC_MULTI_MASTER ( ADC_CDR_RDATA_MST) /*!< In multimode, selection among several ADC instances: ADC master */
Kojto 122:f9eeca106725 1268 #define LL_ADC_MULTI_SLAVE (ADC_CDR_RDATA_SLV ) /*!< In multimode, selection among several ADC instances: ADC slave */
Kojto 122:f9eeca106725 1269 #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 1270 /**
Kojto 122:f9eeca106725 1271 * @}
Kojto 122:f9eeca106725 1272 */
Kojto 122:f9eeca106725 1273
Kojto 122:f9eeca106725 1274 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 1275
Kojto 122:f9eeca106725 1276 /** @defgroup ADC_LL_EC_LEGACY ADC literals legacy naming
Kojto 122:f9eeca106725 1277 * @{
Kojto 122:f9eeca106725 1278 */
Kojto 122:f9eeca106725 1279 #define LL_ADC_REG_TRIG_SW_START (LL_ADC_REG_TRIG_SOFTWARE)
Kojto 122:f9eeca106725 1280 #define LL_ADC_REG_TRIG_EXT_TIM1_CC1 (LL_ADC_REG_TRIG_EXT_TIM1_CH1)
Kojto 122:f9eeca106725 1281 #define LL_ADC_REG_TRIG_EXT_TIM1_CC2 (LL_ADC_REG_TRIG_EXT_TIM1_CH2)
Kojto 122:f9eeca106725 1282 #define LL_ADC_REG_TRIG_EXT_TIM1_CC3 (LL_ADC_REG_TRIG_EXT_TIM1_CH3)
Kojto 122:f9eeca106725 1283 #define LL_ADC_REG_TRIG_EXT_TIM2_CC2 (LL_ADC_REG_TRIG_EXT_TIM2_CH2)
Kojto 122:f9eeca106725 1284 #define LL_ADC_REG_TRIG_EXT_TIM3_CC4 (LL_ADC_REG_TRIG_EXT_TIM3_CH4)
Kojto 122:f9eeca106725 1285 #define LL_ADC_REG_TRIG_EXT_TIM4_CC4 (LL_ADC_REG_TRIG_EXT_TIM4_CH4)
Kojto 122:f9eeca106725 1286
Kojto 122:f9eeca106725 1287 #define LL_ADC_INJ_TRIG_SW_START (LL_ADC_INJ_TRIG_SOFTWARE)
Kojto 122:f9eeca106725 1288 #define LL_ADC_INJ_TRIG_EXT_TIM1_CC4 (LL_ADC_INJ_TRIG_EXT_TIM1_CH4)
Kojto 122:f9eeca106725 1289 #define LL_ADC_INJ_TRIG_EXT_TIM2_CC1 (LL_ADC_INJ_TRIG_EXT_TIM2_CH1)
Kojto 122:f9eeca106725 1290 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC1 (LL_ADC_INJ_TRIG_EXT_TIM3_CH1)
Kojto 122:f9eeca106725 1291 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC3 (LL_ADC_INJ_TRIG_EXT_TIM3_CH3)
Kojto 122:f9eeca106725 1292 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC4 (LL_ADC_INJ_TRIG_EXT_TIM3_CH4)
Kojto 122:f9eeca106725 1293 #define LL_ADC_INJ_TRIG_EXT_TIM8_CC4 (LL_ADC_INJ_TRIG_EXT_TIM8_CH4)
Kojto 122:f9eeca106725 1294
Kojto 122:f9eeca106725 1295 #define LL_ADC_OVS_DATA_SHIFT_NONE (LL_ADC_OVS_SHIFT_NONE)
Kojto 122:f9eeca106725 1296 #define LL_ADC_OVS_DATA_SHIFT_1 (LL_ADC_OVS_SHIFT_RIGHT_1)
Kojto 122:f9eeca106725 1297 #define LL_ADC_OVS_DATA_SHIFT_2 (LL_ADC_OVS_SHIFT_RIGHT_2)
Kojto 122:f9eeca106725 1298 #define LL_ADC_OVS_DATA_SHIFT_3 (LL_ADC_OVS_SHIFT_RIGHT_3)
Kojto 122:f9eeca106725 1299 #define LL_ADC_OVS_DATA_SHIFT_4 (LL_ADC_OVS_SHIFT_RIGHT_4)
Kojto 122:f9eeca106725 1300 #define LL_ADC_OVS_DATA_SHIFT_5 (LL_ADC_OVS_SHIFT_RIGHT_5)
Kojto 122:f9eeca106725 1301 #define LL_ADC_OVS_DATA_SHIFT_6 (LL_ADC_OVS_SHIFT_RIGHT_6)
Kojto 122:f9eeca106725 1302 #define LL_ADC_OVS_DATA_SHIFT_7 (LL_ADC_OVS_SHIFT_RIGHT_7)
Kojto 122:f9eeca106725 1303 #define LL_ADC_OVS_DATA_SHIFT_8 (LL_ADC_OVS_SHIFT_RIGHT_8)
Kojto 122:f9eeca106725 1304
Kojto 122:f9eeca106725 1305 /**
Kojto 122:f9eeca106725 1306 * @}
Kojto 122:f9eeca106725 1307 */
Kojto 122:f9eeca106725 1308
Kojto 122:f9eeca106725 1309
Kojto 122:f9eeca106725 1310 /** @defgroup ADC_LL_EC_HW_DELAYS Definitions of ADC hardware constraints delays
Kojto 122:f9eeca106725 1311 * @note Only ADC IP HW delays are defined in ADC LL driver driver,
Kojto 122:f9eeca106725 1312 * not timeout values.
Kojto 122:f9eeca106725 1313 * For details on delays values, refer to descriptions in source code
Kojto 122:f9eeca106725 1314 * above each literal definition.
Kojto 122:f9eeca106725 1315 * @{
Kojto 122:f9eeca106725 1316 */
Kojto 122:f9eeca106725 1317
Kojto 122:f9eeca106725 1318 /* Note: Only ADC IP HW delays are defined in ADC LL driver driver, */
Kojto 122:f9eeca106725 1319 /* not timeout values. */
Kojto 122:f9eeca106725 1320 /* Timeout values for ADC operations are dependent to device clock */
Kojto 122:f9eeca106725 1321 /* configuration (system clock versus ADC clock), */
Kojto 122:f9eeca106725 1322 /* and therefore must be defined in user application. */
Kojto 122:f9eeca106725 1323 /* Indications for estimation of ADC timeout delays, for this */
Kojto 122:f9eeca106725 1324 /* STM32 serie: */
Kojto 122:f9eeca106725 1325 /* - ADC calibration time: maximum delay is 112/fADC. */
Kojto 122:f9eeca106725 1326 /* (refer to device datasheet, parameter "tCAL") */
Kojto 122:f9eeca106725 1327 /* - ADC enable time: maximum delay is 1 conversion cycle. */
Kojto 122:f9eeca106725 1328 /* (refer to device datasheet, parameter "tSTAB") */
Kojto 122:f9eeca106725 1329 /* - ADC disable time: maximum delay should be a few ADC clock cycles */
Kojto 122:f9eeca106725 1330 /* - ADC stop conversion time: maximum delay should be a few ADC clock */
Kojto 122:f9eeca106725 1331 /* cycles */
Kojto 122:f9eeca106725 1332 /* - ADC conversion time: duration depending on ADC clock and ADC */
Kojto 122:f9eeca106725 1333 /* configuration. */
Kojto 122:f9eeca106725 1334 /* (refer to device reference manual, section "Timing") */
Kojto 122:f9eeca106725 1335
Kojto 122:f9eeca106725 1336 /* Delay for ADC stabilization time (ADC voltage regulator start-up time) */
Kojto 122:f9eeca106725 1337 /* Delay set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1338 /* parameter "tADCVREG_STUP"). */
Kojto 122:f9eeca106725 1339 /* Unit: us */
Kojto 122:f9eeca106725 1340 #define LL_ADC_DELAY_INTERNAL_REGUL_STAB_US ((uint32_t) 10U) /*!< Delay for ADC stabilization time (ADC voltage regulator start-up time) */
Kojto 122:f9eeca106725 1341
Kojto 122:f9eeca106725 1342 /* Delay for internal voltage reference stabilization time. */
Kojto 122:f9eeca106725 1343 /* Delay set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1344 /* parameter "tstart_vrefint"). */
Kojto 122:f9eeca106725 1345 /* Unit: us */
Kojto 122:f9eeca106725 1346 #define LL_ADC_DELAY_VREFINT_STAB_US ((uint32_t) 12U) /*!< Delay for internal voltage reference stabilization time */
Kojto 122:f9eeca106725 1347
Kojto 122:f9eeca106725 1348 /* Delay for temperature sensor stabilization time. */
Kojto 122:f9eeca106725 1349 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1350 /* parameter "tSTART"). */
Kojto 122:f9eeca106725 1351 /* Unit: us */
Kojto 122:f9eeca106725 1352 #define LL_ADC_DELAY_TEMPSENSOR_STAB_US ((uint32_t) 120U) /*!< Delay for temperature sensor stabilization time */
Kojto 122:f9eeca106725 1353
Kojto 122:f9eeca106725 1354 /* Delay required between ADC end of calibration and ADC enable. */
Kojto 122:f9eeca106725 1355 /* Note: On this STM32 serie, a minimum number of ADC clock cycles */
Kojto 122:f9eeca106725 1356 /* are required between ADC end of calibration and ADC enable. */
Kojto 122:f9eeca106725 1357 /* Wait time can be computed in user application by waiting for the */
Kojto 122:f9eeca106725 1358 /* equivalent number of CPU cycles, by taking into account */
Kojto 122:f9eeca106725 1359 /* ratio of CPU clock versus ADC clock prescalers. */
Kojto 122:f9eeca106725 1360 /* Unit: ADC clock cycles. */
Kojto 122:f9eeca106725 1361 #define LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES ((uint32_t) 4U) /*!< Delay required between ADC end of calibration and ADC enable */
Kojto 122:f9eeca106725 1362
Kojto 122:f9eeca106725 1363 /**
Kojto 122:f9eeca106725 1364 * @}
Kojto 122:f9eeca106725 1365 */
Kojto 122:f9eeca106725 1366
Kojto 122:f9eeca106725 1367 /**
Kojto 122:f9eeca106725 1368 * @}
Kojto 122:f9eeca106725 1369 */
Kojto 122:f9eeca106725 1370
Kojto 122:f9eeca106725 1371
Kojto 122:f9eeca106725 1372 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 1373 /** @defgroup ADC_LL_Exported_Macros ADC Exported Macros
Kojto 122:f9eeca106725 1374 * @{
Kojto 122:f9eeca106725 1375 */
Kojto 122:f9eeca106725 1376
Kojto 122:f9eeca106725 1377 /** @defgroup ADC_LL_EM_WRITE_READ Common write and read registers Macros
Kojto 122:f9eeca106725 1378 * @{
Kojto 122:f9eeca106725 1379 */
Kojto 122:f9eeca106725 1380
Kojto 122:f9eeca106725 1381 /**
Kojto 122:f9eeca106725 1382 * @brief Write a value in ADC register
Kojto 122:f9eeca106725 1383 * @param __INSTANCE__ ADC Instance
Kojto 122:f9eeca106725 1384 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 1385 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 1386 * @retval None
Kojto 122:f9eeca106725 1387 */
Kojto 122:f9eeca106725 1388 #define LL_ADC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 1389
Kojto 122:f9eeca106725 1390 /**
Kojto 122:f9eeca106725 1391 * @brief Read a value in ADC register
Kojto 122:f9eeca106725 1392 * @param __INSTANCE__ ADC Instance
Kojto 122:f9eeca106725 1393 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 1394 * @retval Register value
Kojto 122:f9eeca106725 1395 */
Kojto 122:f9eeca106725 1396 #define LL_ADC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 1397 /**
Kojto 122:f9eeca106725 1398 * @}
Kojto 122:f9eeca106725 1399 */
Kojto 122:f9eeca106725 1400
Kojto 122:f9eeca106725 1401 /** @defgroup ADC_LL_EM_HELPER_MACRO ADC helper macro
Kojto 122:f9eeca106725 1402 * @{
Kojto 122:f9eeca106725 1403 */
Kojto 122:f9eeca106725 1404
Kojto 122:f9eeca106725 1405 /**
Kojto 122:f9eeca106725 1406 * @brief Helper macro to get ADC channel number in decimal format
Kojto 122:f9eeca106725 1407 * from literals LL_ADC_CHANNEL_x.
Kojto 122:f9eeca106725 1408 * @note Example:
Kojto 122:f9eeca106725 1409 * __LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_4)
Kojto 122:f9eeca106725 1410 * will return decimal number "4".
Kojto 122:f9eeca106725 1411 * @note The input can be a value from functions where a channel
Kojto 122:f9eeca106725 1412 * number is returned, either defined with number
Kojto 122:f9eeca106725 1413 * or with bitfield (only one bit must be set).
Kojto 122:f9eeca106725 1414 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1415 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1416 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1417 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1418 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1419 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1420 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1421 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1422 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1423 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1424 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1425 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1426 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1427 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1428 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1429 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1430 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1431 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1432 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1433 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1434 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1435 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1436 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1437 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1438 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1439 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1440 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1441 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1442 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1443 *
Kojto 122:f9eeca106725 1444 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1445 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1446 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1447 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1448 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1449 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1450 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1451 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1452 * @retval Value between Min_Data=0 and Max_Data=18
Kojto 122:f9eeca106725 1453 */
Kojto 122:f9eeca106725 1454 #define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
Kojto 122:f9eeca106725 1455 ((((__CHANNEL__) & ADC_CHANNEL_ID_BITFIELD_MASK) == 0U) \
Kojto 122:f9eeca106725 1456 ? ( \
Kojto 122:f9eeca106725 1457 ((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS \
Kojto 122:f9eeca106725 1458 ) \
Kojto 122:f9eeca106725 1459 : \
Kojto 122:f9eeca106725 1460 ( \
Kojto 122:f9eeca106725 1461 POSITION_VAL((__CHANNEL__)) \
Kojto 122:f9eeca106725 1462 ) \
Kojto 122:f9eeca106725 1463 )
Kojto 122:f9eeca106725 1464
Kojto 122:f9eeca106725 1465 /**
Kojto 122:f9eeca106725 1466 * @brief Helper macro to get ADC channel in literal format LL_ADC_CHANNEL_x
Kojto 122:f9eeca106725 1467 * from number in decimal format.
Kojto 122:f9eeca106725 1468 * @note Example:
Kojto 122:f9eeca106725 1469 * __LL_ADC_DECIMAL_NB_TO_CHANNEL(4)
Kojto 122:f9eeca106725 1470 * will return a data equivalent to "LL_ADC_CHANNEL_4".
Kojto 122:f9eeca106725 1471 * @param __DECIMAL_NB__: Value between Min_Data=0 and Max_Data=18
Kojto 122:f9eeca106725 1472 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1473 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1474 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1475 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1476 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1477 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1478 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1479 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1480 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1481 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1482 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1483 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1484 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1485 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1486 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1487 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1488 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1489 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1490 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1491 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1492 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1493 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1494 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1495 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1496 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1497 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1498 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1499 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1500 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1501 *
Kojto 122:f9eeca106725 1502 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1503 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1504 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1505 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1506 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1507 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1508 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1509 * 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 1510 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 1511 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 1512 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 1513 */
Kojto 122:f9eeca106725 1514 #define __LL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__) \
Kojto 122:f9eeca106725 1515 (((__DECIMAL_NB__) <= 9U) \
Kojto 122:f9eeca106725 1516 ? ( \
Kojto 122:f9eeca106725 1517 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
Kojto 122:f9eeca106725 1518 (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__)) | \
Kojto 122:f9eeca106725 1519 (ADC_SMPR1_REGOFFSET | (((uint32_t) (3U * (__DECIMAL_NB__))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
Kojto 122:f9eeca106725 1520 ) \
Kojto 122:f9eeca106725 1521 : \
Kojto 122:f9eeca106725 1522 ( \
Kojto 122:f9eeca106725 1523 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
Kojto 122:f9eeca106725 1524 (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__)) | \
Kojto 122:f9eeca106725 1525 (ADC_SMPR2_REGOFFSET | (((uint32_t) (3U * ((__DECIMAL_NB__) - 10U))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
Kojto 122:f9eeca106725 1526 ) \
Kojto 122:f9eeca106725 1527 )
Kojto 122:f9eeca106725 1528
Kojto 122:f9eeca106725 1529 /**
Kojto 122:f9eeca106725 1530 * @brief Helper macro to determine whether the selected channel
Kojto 122:f9eeca106725 1531 * corresponds to literal definitions of driver.
Kojto 122:f9eeca106725 1532 * @note The different literal definitions of ADC channels are:
Kojto 122:f9eeca106725 1533 * - ADC internal channel:
Kojto 122:f9eeca106725 1534 * LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...
Kojto 122:f9eeca106725 1535 * - ADC external channel (channel connected to a GPIO pin):
Kojto 122:f9eeca106725 1536 * LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...
Kojto 122:f9eeca106725 1537 * @note The channel parameter must be a value defined from literal
Kojto 122:f9eeca106725 1538 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1539 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1540 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...),
Kojto 122:f9eeca106725 1541 * must not be a value from functions where a channel number is
Kojto 122:f9eeca106725 1542 * returned from ADC registers,
Kojto 122:f9eeca106725 1543 * because internal and external channels share the same channel
Kojto 122:f9eeca106725 1544 * number in ADC registers. The differentiation is made only with
Kojto 122:f9eeca106725 1545 * parameters definitions of driver.
Kojto 122:f9eeca106725 1546 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1547 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1548 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1549 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1550 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1551 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1552 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1553 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1554 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1555 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1556 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1557 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1558 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1559 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1560 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1561 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1562 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1563 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1564 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1565 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1566 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1567 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1568 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1569 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1570 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1571 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1572 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1573 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1574 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1575 *
Kojto 122:f9eeca106725 1576 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1577 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1578 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1579 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1580 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1581 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1582 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1583 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1584 * @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 1585 * Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
Kojto 122:f9eeca106725 1586 */
Kojto 122:f9eeca106725 1587 #define __LL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__) \
Kojto 122:f9eeca106725 1588 (((__CHANNEL__) & ADC_CHANNEL_ID_INTERNAL_CH_MASK) != 0U)
Kojto 122:f9eeca106725 1589
Kojto 122:f9eeca106725 1590 /**
Kojto 122:f9eeca106725 1591 * @brief Helper macro to convert a channel defined from parameter
Kojto 122:f9eeca106725 1592 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1593 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1594 * to its equivalent parameter definition of a ADC external channel
Kojto 122:f9eeca106725 1595 * (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...).
Kojto 122:f9eeca106725 1596 * @note The channel parameter can be, additionally to a value
Kojto 122:f9eeca106725 1597 * defined from parameter definition of a ADC internal channel
Kojto 122:f9eeca106725 1598 * (LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1599 * a value defined from parameter definition of
Kojto 122:f9eeca106725 1600 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
Kojto 122:f9eeca106725 1601 * or a value from functions where a channel number is returned
Kojto 122:f9eeca106725 1602 * from ADC registers.
Kojto 122:f9eeca106725 1603 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1604 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1605 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1606 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1607 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1608 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1609 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1610 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1611 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1612 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1613 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1614 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1615 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1616 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1617 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1618 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1619 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1620 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1621 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1622 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1623 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1624 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1625 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1626 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1627 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1628 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1629 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1630 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1631 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1632 *
Kojto 122:f9eeca106725 1633 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1634 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1635 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1636 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1637 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1638 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1639 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1640 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1641 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1642 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1643 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 1644 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 1645 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 1646 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 1647 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 1648 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1649 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1650 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1651 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1652 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1653 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1654 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1655 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1656 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1657 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1658 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1659 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1660 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1661 */
Kojto 122:f9eeca106725 1662 #define __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__) \
Kojto 122:f9eeca106725 1663 ((__CHANNEL__) & ~ADC_CHANNEL_ID_INTERNAL_CH_MASK)
Kojto 122:f9eeca106725 1664
Kojto 122:f9eeca106725 1665 /**
Kojto 122:f9eeca106725 1666 * @brief Helper macro to determine whether the internal channel
Kojto 122:f9eeca106725 1667 * selected is available on the ADC instance selected.
Kojto 122:f9eeca106725 1668 * @note The channel parameter must be a value defined from parameter
Kojto 122:f9eeca106725 1669 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1670 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1671 * must not be a value defined from parameter definition of
Kojto 122:f9eeca106725 1672 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
Kojto 122:f9eeca106725 1673 * or a value from functions where a channel number is
Kojto 122:f9eeca106725 1674 * returned from ADC registers,
Kojto 122:f9eeca106725 1675 * because internal and external channels share the same channel
Kojto 122:f9eeca106725 1676 * number in ADC registers. The differentiation is made only with
Kojto 122:f9eeca106725 1677 * parameters definitions of driver.
Kojto 122:f9eeca106725 1678 * @param __ADC_INSTANCE__ ADC instance
Kojto 122:f9eeca106725 1679 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1680 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1681 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1682 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1683 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1684 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1685 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1686 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1687 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1688 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1689 *
Kojto 122:f9eeca106725 1690 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1691 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1692 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1693 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1694 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1695 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1696 * @retval Value "0" if the internal channel selected is not available on the ADC instance selected.
Kojto 122:f9eeca106725 1697 * Value "1" if the internal channel selected is available on the ADC instance selected.
Kojto 122:f9eeca106725 1698 */
Kojto 122:f9eeca106725 1699 #if defined (ADC1) && defined (ADC2) && defined (ADC3)
Kojto 122:f9eeca106725 1700 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1701 (((__ADC_INSTANCE__) == ADC1) \
Kojto 122:f9eeca106725 1702 ? ( \
Kojto 122:f9eeca106725 1703 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1704 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1705 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) \
Kojto 122:f9eeca106725 1706 ) \
Kojto 122:f9eeca106725 1707 : \
Kojto 122:f9eeca106725 1708 ((__ADC_INSTANCE__) == ADC2) \
Kojto 122:f9eeca106725 1709 ? ( \
Kojto 122:f9eeca106725 1710 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1711 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) || \
Kojto 122:f9eeca106725 1712 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2) \
Kojto 122:f9eeca106725 1713 ) \
Kojto 122:f9eeca106725 1714 : \
Kojto 122:f9eeca106725 1715 ((__ADC_INSTANCE__) == ADC3) \
Kojto 122:f9eeca106725 1716 ? ( \
Kojto 122:f9eeca106725 1717 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1718 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1719 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) || \
Kojto 122:f9eeca106725 1720 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC3) || \
Kojto 122:f9eeca106725 1721 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC3) \
Kojto 122:f9eeca106725 1722 ) \
Kojto 122:f9eeca106725 1723 : \
Kojto 122:f9eeca106725 1724 (0U) \
Kojto 122:f9eeca106725 1725 )
Kojto 122:f9eeca106725 1726 #elif defined (ADC1) && defined (ADC2)
Kojto 122:f9eeca106725 1727 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1728 (((__ADC_INSTANCE__) == ADC1) \
Kojto 122:f9eeca106725 1729 ? ( \
Kojto 122:f9eeca106725 1730 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1731 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1732 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) \
Kojto 122:f9eeca106725 1733 ) \
Kojto 122:f9eeca106725 1734 : \
Kojto 122:f9eeca106725 1735 ((__ADC_INSTANCE__) == ADC2) \
Kojto 122:f9eeca106725 1736 ? ( \
Kojto 122:f9eeca106725 1737 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1738 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) || \
Kojto 122:f9eeca106725 1739 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2) \
Kojto 122:f9eeca106725 1740 ) \
Kojto 122:f9eeca106725 1741 : \
Kojto 122:f9eeca106725 1742 (0U) \
Kojto 122:f9eeca106725 1743 )
Kojto 122:f9eeca106725 1744 #elif defined (ADC1)
Kojto 122:f9eeca106725 1745 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1746 ( \
Kojto 122:f9eeca106725 1747 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1748 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1749 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) || \
Kojto 122:f9eeca106725 1750 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1) || \
Kojto 122:f9eeca106725 1751 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2) \
Kojto 122:f9eeca106725 1752 )
Kojto 122:f9eeca106725 1753 #endif
Kojto 122:f9eeca106725 1754
Kojto 122:f9eeca106725 1755 /**
Kojto 122:f9eeca106725 1756 * @brief Helper macro to define ADC analog watchdog parameter:
Kojto 122:f9eeca106725 1757 * define a single channel to monitor with analog watchdog
Kojto 122:f9eeca106725 1758 * from sequencer channel and groups definition.
Kojto 122:f9eeca106725 1759 * @note To be used with function @ref LL_ADC_SetAnalogWDMonitChannels().
Kojto 122:f9eeca106725 1760 * Example:
Kojto 122:f9eeca106725 1761 * LL_ADC_SetAnalogWDMonitChannels(
Kojto 122:f9eeca106725 1762 * ADC1, LL_ADC_AWD1,
Kojto 122:f9eeca106725 1763 * __LL_ADC_ANALOGWD_CHANNEL_GROUP(LL_ADC_CHANNEL4, LL_ADC_GROUP_REGULAR))
Kojto 122:f9eeca106725 1764 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1765 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1766 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1767 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1768 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1769 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1770 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1771 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1772 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1773 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1774 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1775 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1776 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1777 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1778 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1779 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1780 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1781 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1782 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1783 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1784 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1785 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1786 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1787 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1788 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1789 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1790 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1791 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1792 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1793 *
Kojto 122:f9eeca106725 1794 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1795 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1796 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1797 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1798 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1799 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1800 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1801 * 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 1802 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 1803 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 1804 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 1805 * @param __GROUP__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1806 * @arg @ref LL_ADC_GROUP_REGULAR
Kojto 122:f9eeca106725 1807 * @arg @ref LL_ADC_GROUP_INJECTED
Kojto 122:f9eeca106725 1808 * @arg @ref LL_ADC_GROUP_REGULAR_INJECTED
Kojto 122:f9eeca106725 1809 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1810 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 1811 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 1812 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 1813 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 1814 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 1815 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 1816 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 1817 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 1818 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 1819 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 1820 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 1821 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 1822 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 1823 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 1824 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 1825 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 1826 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 1827 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 1828 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 1829 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 1830 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 1831 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 1832 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 1833 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 1834 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 1835 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 1836 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 1837 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 1838 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 1839 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 1840 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 1841 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 1842 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 1843 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 1844 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 1845 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 1846 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 1847 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 1848 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 1849 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 1850 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 1851 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 1852 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 1853 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 1854 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 1855 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 1856 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 1857 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 1858 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 1859 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 1860 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 1861 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 1862 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 1863 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 1864 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 1865 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 1866 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 1867 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 1868 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 1869 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 1870 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 1871 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (0)(1)
Kojto 122:f9eeca106725 1872 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (0)(1)
Kojto 122:f9eeca106725 1873 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
Kojto 122:f9eeca106725 1874 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (0)(4)
Kojto 122:f9eeca106725 1875 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (0)(4)
Kojto 122:f9eeca106725 1876 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (4)
Kojto 122:f9eeca106725 1877 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (0)(4)
Kojto 122:f9eeca106725 1878 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (0)(4)
Kojto 122:f9eeca106725 1879 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (4)
Kojto 122:f9eeca106725 1880 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG (0)(2)(5)
Kojto 122:f9eeca106725 1881 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_INJ (0)(2)(5)
Kojto 122:f9eeca106725 1882 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG_INJ (2)(5)
Kojto 122:f9eeca106725 1883 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG (0)(2)(5)
Kojto 122:f9eeca106725 1884 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_INJ (0)(2)(5)
Kojto 122:f9eeca106725 1885 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG_INJ (2)(5)
Kojto 122:f9eeca106725 1886 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 1887 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 1888 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 1889 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 1890 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 1891 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 1892 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 1893 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 1894 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 1895 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 1896 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 1897 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 1898 *
Kojto 122:f9eeca106725 1899 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.\n
Kojto 122:f9eeca106725 1900 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1901 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1902 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1903 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
Kojto 122:f9eeca106725 1904 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1905 * (6) On STM32L4, parameter available on devices with several ADC instances.
Kojto 122:f9eeca106725 1906 */
Kojto 122:f9eeca106725 1907 #define __LL_ADC_ANALOGWD_CHANNEL_GROUP(__CHANNEL__, __GROUP__) \
Kojto 122:f9eeca106725 1908 (((__GROUP__) == LL_ADC_GROUP_REGULAR) \
Kojto 122:f9eeca106725 1909 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1910 : \
Kojto 122:f9eeca106725 1911 ((__GROUP__) == LL_ADC_GROUP_INJECTED) \
Kojto 122:f9eeca106725 1912 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1913 : \
Kojto 122:f9eeca106725 1914 (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1915 )
Kojto 122:f9eeca106725 1916
Kojto 122:f9eeca106725 1917 /**
Kojto 122:f9eeca106725 1918 * @brief Helper macro to set the value of ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1919 * or low in function of ADC resolution, when ADC resolution is
Kojto 122:f9eeca106725 1920 * different of 12 bits.
Kojto 122:f9eeca106725 1921 * @note To be used with function @ref LL_ADC_ConfigAnalogWDThresholds()
Kojto 122:f9eeca106725 1922 * or @ref LL_ADC_SetAnalogWDThresholds().
Kojto 122:f9eeca106725 1923 * Example, with a ADC resolution of 8 bits, to set the value of
Kojto 122:f9eeca106725 1924 * analog watchdog threshold high (on 8 bits):
Kojto 122:f9eeca106725 1925 * LL_ADC_SetAnalogWDThresholds
Kojto 122:f9eeca106725 1926 * (< ADCx param >,
Kojto 122:f9eeca106725 1927 * __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(LL_ADC_RESOLUTION_8B, <threshold_value_8_bits>)
Kojto 122:f9eeca106725 1928 * );
Kojto 122:f9eeca106725 1929 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1930 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 1931 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 1932 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 1933 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 1934 * @param __AWD_THRESHOLD__ Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1935 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1936 */
Kojto 122:f9eeca106725 1937 #define __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD__) \
Kojto 122:f9eeca106725 1938 ((__AWD_THRESHOLD__) << ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U )))
Kojto 122:f9eeca106725 1939
Kojto 122:f9eeca106725 1940 /**
Kojto 122:f9eeca106725 1941 * @brief Helper macro to get the value of ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1942 * or low in function of ADC resolution, when ADC resolution is
Kojto 122:f9eeca106725 1943 * different of 12 bits.
Kojto 122:f9eeca106725 1944 * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
Kojto 122:f9eeca106725 1945 * Example, with a ADC resolution of 8 bits, to get the value of
Kojto 122:f9eeca106725 1946 * analog watchdog threshold high (on 8 bits):
Kojto 122:f9eeca106725 1947 * < threshold_value_6_bits > = __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION
Kojto 122:f9eeca106725 1948 * (LL_ADC_RESOLUTION_8B,
Kojto 122:f9eeca106725 1949 * LL_ADC_GetAnalogWDThresholds(<ADCx param>, LL_ADC_AWD_THRESHOLD_HIGH)
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_12_BITS__ 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_GET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD_12_BITS__) \
Kojto 122:f9eeca106725 1960 ((__AWD_THRESHOLD_12_BITS__) >> ((__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 ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1964 * or low from raw value containing both thresholds concatenated.
Kojto 122:f9eeca106725 1965 * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
Kojto 122:f9eeca106725 1966 * Example, to get analog watchdog threshold high from the register raw value:
Kojto 122:f9eeca106725 1967 * __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(LL_ADC_AWD_THRESHOLD_HIGH, <raw_value_with_both_thresholds>);
Kojto 122:f9eeca106725 1968 * @param __AWD_THRESHOLD_TYPE__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1969 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 1970 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 1971 * @param __AWD_THRESHOLDS__ Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 1972 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1973 */
Kojto 122:f9eeca106725 1974 #define __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(__AWD_THRESHOLD_TYPE__, __AWD_THRESHOLDS__) \
Kojto 122:f9eeca106725 1975 (((__AWD_THRESHOLDS__) >> POSITION_VAL((__AWD_THRESHOLD_TYPE__))) & LL_ADC_AWD_THRESHOLD_LOW)
Kojto 122:f9eeca106725 1976
Kojto 122:f9eeca106725 1977 /**
Kojto 122:f9eeca106725 1978 * @brief Helper macro to set the ADC calibration value with both single ended
Kojto 122:f9eeca106725 1979 * and differential modes calibration factors concatenated.
Kojto 122:f9eeca106725 1980 * @note To be used with function @ref LL_ADC_SetCalibrationFactor().
Kojto 122:f9eeca106725 1981 * Example, to set calibration factors single ended to 0x55
Kojto 122:f9eeca106725 1982 * and differential ended to 0x2A:
Kojto 122:f9eeca106725 1983 * LL_ADC_SetCalibrationFactor(
Kojto 122:f9eeca106725 1984 * ADC1,
Kojto 122:f9eeca106725 1985 * __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(0x55, 0x2A))
Kojto 122:f9eeca106725 1986 * @param __CALIB_FACTOR_SINGLE_ENDED__ Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 1987 * @param __CALIB_FACTOR_DIFFERENTIAL__ Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 1988 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 1989 */
Kojto 122:f9eeca106725 1990 #define __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(__CALIB_FACTOR_SINGLE_ENDED__, __CALIB_FACTOR_DIFFERENTIAL__) \
Kojto 122:f9eeca106725 1991 (((__CALIB_FACTOR_DIFFERENTIAL__) << POSITION_VAL(ADC_CALFACT_CALFACT_D)) | (__CALIB_FACTOR_SINGLE_ENDED__))
Kojto 122:f9eeca106725 1992
Kojto 122:f9eeca106725 1993 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 1994 /**
Kojto 122:f9eeca106725 1995 * @brief Helper macro to get the ADC multimode conversion data of ADC master
Kojto 122:f9eeca106725 1996 * or ADC slave from raw value with both ADC conversion data concatenated.
Kojto 122:f9eeca106725 1997 * @note This macro is intended to be used when multimode transfer by DMA
Kojto 122:f9eeca106725 1998 * is enabled: refer to function @ref LL_ADC_SetMultiDMATransfer().
Kojto 122:f9eeca106725 1999 * In this case the transferred data need to processed with this macro
Kojto 122:f9eeca106725 2000 * to separate the conversion data of ADC master and ADC slave.
Kojto 122:f9eeca106725 2001 * @param __ADC_MULTI_MASTER_SLAVE__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2002 * @arg @ref LL_ADC_MULTI_MASTER
Kojto 122:f9eeca106725 2003 * @arg @ref LL_ADC_MULTI_SLAVE
Kojto 122:f9eeca106725 2004 * @param __ADC_MULTI_CONV_DATA__ Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2005 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2006 */
Kojto 122:f9eeca106725 2007 #define __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE(__ADC_MULTI_MASTER_SLAVE__, __ADC_MULTI_CONV_DATA__) \
Kojto 122:f9eeca106725 2008 (((__ADC_MULTI_CONV_DATA__) >> POSITION_VAL((__ADC_MULTI_MASTER_SLAVE__))) & ADC_CDR_RDATA_MST)
Kojto 122:f9eeca106725 2009 #endif
Kojto 122:f9eeca106725 2010
Kojto 122:f9eeca106725 2011 /**
Kojto 122:f9eeca106725 2012 * @brief Helper macro to select the ADC common instance
Kojto 122:f9eeca106725 2013 * to which is belonging the selected ADC instance.
Kojto 122:f9eeca106725 2014 * @note ADC common register instance can be used for:
Kojto 122:f9eeca106725 2015 * - Set parameters common to several ADC instances
Kojto 122:f9eeca106725 2016 * - Multimode (for devices with several ADC instances)
Kojto 122:f9eeca106725 2017 * Refer to functions having argument "ADCxy_COMMON" as parameter.
Kojto 122:f9eeca106725 2018 * @param __ADCx__ ADC instance
Kojto 122:f9eeca106725 2019 * @retval ADC common register instance
Kojto 122:f9eeca106725 2020 */
Kojto 122:f9eeca106725 2021 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
Kojto 122:f9eeca106725 2022 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2023 (ADC123_COMMON)
Kojto 122:f9eeca106725 2024 #elif defined(ADC1) && defined(ADC2)
Kojto 122:f9eeca106725 2025 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2026 (ADC12_COMMON)
Kojto 122:f9eeca106725 2027 #else
Kojto 122:f9eeca106725 2028 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2029 (ADC1_COMMON)
Kojto 122:f9eeca106725 2030 #endif
Kojto 122:f9eeca106725 2031
Kojto 122:f9eeca106725 2032 /**
Kojto 122:f9eeca106725 2033 * @brief Helper macro to check if all ADC instances sharing the same
Kojto 122:f9eeca106725 2034 * ADC common instance are disabled.
Kojto 122:f9eeca106725 2035 * @note This check is required by functions with setting conditioned to
Kojto 122:f9eeca106725 2036 * ADC state:
Kojto 122:f9eeca106725 2037 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2038 * Refer to functions having argument "ADCxy_COMMON" as parameter.
Kojto 122:f9eeca106725 2039 * @note On devices with only 1 ADC common instance, parameter of this macro
Kojto 122:f9eeca106725 2040 * is useless and can be ignored (parameter kept for compatibility
Kojto 122:f9eeca106725 2041 * with devices featuring several ADC common instances).
Kojto 122:f9eeca106725 2042 * @param __ADCXY_COMMON__ ADC common instance
Kojto 122:f9eeca106725 2043 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2044 * @retval Value "0" if all ADC instances sharing the same ADC common instance
Kojto 122:f9eeca106725 2045 * are disabled.
Kojto 122:f9eeca106725 2046 * Value "1" if at least one ADC instance sharing the same ADC common instance
Kojto 122:f9eeca106725 2047 * is enabled.
Kojto 122:f9eeca106725 2048 */
Kojto 122:f9eeca106725 2049 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
Kojto 122:f9eeca106725 2050 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2051 (LL_ADC_IsEnabled(ADC1) | \
Kojto 122:f9eeca106725 2052 LL_ADC_IsEnabled(ADC2) | \
Kojto 122:f9eeca106725 2053 LL_ADC_IsEnabled(ADC3) )
Kojto 122:f9eeca106725 2054 #elif defined(ADC1) && defined(ADC2)
Kojto 122:f9eeca106725 2055 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2056 (LL_ADC_IsEnabled(ADC1) | \
Kojto 122:f9eeca106725 2057 LL_ADC_IsEnabled(ADC2) )
Kojto 122:f9eeca106725 2058 #else
Kojto 122:f9eeca106725 2059 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2060 (LL_ADC_IsEnabled(ADC1))
Kojto 122:f9eeca106725 2061 #endif
Kojto 122:f9eeca106725 2062
Kojto 122:f9eeca106725 2063 /**
Kojto 122:f9eeca106725 2064 * @brief Helper macro to define the ADC conversion data full-scale digital
Kojto 122:f9eeca106725 2065 * value corresponding to the selected ADC resolution.
Kojto 122:f9eeca106725 2066 * @note ADC conversion data full-scale corresponds to voltage range
Kojto 122:f9eeca106725 2067 * determined by analog voltage references Vref+ and Vref-
Kojto 122:f9eeca106725 2068 * (refer to reference manual).
Kojto 122:f9eeca106725 2069 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2070 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2071 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2072 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2073 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2074 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
Kojto 122:f9eeca106725 2075 */
Kojto 122:f9eeca106725 2076 #define __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2077 (((uint32_t)0xFFFU) >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U)))
Kojto 122:f9eeca106725 2078
Kojto 122:f9eeca106725 2079 /**
Kojto 122:f9eeca106725 2080 * @brief Helper macro to convert the ADC conversion data from
Kojto 122:f9eeca106725 2081 * a resolution to another resolution.
Kojto 122:f9eeca106725 2082 * @param __DATA__ ADC conversion data to be converted
Kojto 122:f9eeca106725 2083 * @param __ADC_RESOLUTION_CURRENT__ Resolution of to the data to be converted
Kojto 122:f9eeca106725 2084 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2085 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2086 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2087 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2088 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2089 * @param __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
Kojto 122:f9eeca106725 2090 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2091 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2092 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2093 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2094 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2095 * @retval ADC conversion data to the requested resolution
Kojto 122:f9eeca106725 2096 */
Kojto 122:f9eeca106725 2097 #define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__,\
Kojto 122:f9eeca106725 2098 __ADC_RESOLUTION_CURRENT__,\
Kojto 122:f9eeca106725 2099 __ADC_RESOLUTION_TARGET__) \
Kojto 122:f9eeca106725 2100 (((__DATA__) \
Kojto 122:f9eeca106725 2101 << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U))) \
Kojto 122:f9eeca106725 2102 >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U)) \
Kojto 122:f9eeca106725 2103 )
Kojto 122:f9eeca106725 2104
Kojto 122:f9eeca106725 2105 /**
Kojto 122:f9eeca106725 2106 * @brief Helper macro to calculate the voltage (unit: mVolt)
Kojto 122:f9eeca106725 2107 * corresponding to a ADC conversion data (unit: digital value).
Kojto 122:f9eeca106725 2108 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2109 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2110 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2111 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2112 * @param __ADC_DATA__ ADC conversion data (resolution 12 bits)
Kojto 122:f9eeca106725 2113 * (unit: digital value).
Kojto 122:f9eeca106725 2114 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2115 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2116 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2117 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2118 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2119 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
Kojto 122:f9eeca106725 2120 */
Kojto 122:f9eeca106725 2121 #define __LL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2122 __ADC_DATA__,\
Kojto 122:f9eeca106725 2123 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2124 ((__ADC_DATA__) * (__VREFANALOG_VOLTAGE__) \
Kojto 122:f9eeca106725 2125 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2126 )
Kojto 122:f9eeca106725 2127
Kojto 122:f9eeca106725 2128 /* Legacy define */
Kojto 122:f9eeca106725 2129 #define __LL_ADC_CALC_DATA_VOLTAGE() __LL_ADC_CALC_DATA_TO_VOLTAGE()
Kojto 122:f9eeca106725 2130
Kojto 122:f9eeca106725 2131 /**
Kojto 122:f9eeca106725 2132 * @brief Helper macro to calculate analog reference voltage (Vref+)
Kojto 122:f9eeca106725 2133 * (unit: mVolt) from ADC conversion data of internal voltage
Kojto 122:f9eeca106725 2134 * reference VrefInt.
Kojto 122:f9eeca106725 2135 * @note Computation is using VrefInt calibration value
Kojto 122:f9eeca106725 2136 * stored in system memory for each device during production.
Kojto 122:f9eeca106725 2137 * @note This voltage depends on user board environment: voltage level
Kojto 122:f9eeca106725 2138 * connected to pin Vref+.
Kojto 122:f9eeca106725 2139 * On devices with small package, the pin Vref+ is not present
Kojto 122:f9eeca106725 2140 * and internally bonded to pin Vdda.
Kojto 122:f9eeca106725 2141 * @note On this STM32 serie, calibration data of internal voltage reference
Kojto 122:f9eeca106725 2142 * VrefInt corresponds to a resolution of 12 bits,
Kojto 122:f9eeca106725 2143 * this is the recommended ADC resolution to convert voltage of
Kojto 122:f9eeca106725 2144 * internal voltage reference VrefInt.
Kojto 122:f9eeca106725 2145 * Otherwise, this macro performs the processing to scale
Kojto 122:f9eeca106725 2146 * ADC conversion data to 12 bits.
Kojto 122:f9eeca106725 2147 * @param __VREFINT_ADC_DATA__: ADC conversion data (resolution 12 bits)
Kojto 122:f9eeca106725 2148 * of internal voltage reference VrefInt (unit: digital value).
Kojto 122:f9eeca106725 2149 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2150 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2151 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2152 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2153 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2154 * @retval Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2155 */
Kojto 122:f9eeca106725 2156 #define __LL_ADC_CALC_VREFANALOG_VOLTAGE(__VREFINT_ADC_DATA__,\
Kojto 122:f9eeca106725 2157 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2158 (((uint32_t)(*VREFINT_CAL_ADDR) * VREFINT_CAL_VREF) \
Kojto 122:f9eeca106725 2159 / __LL_ADC_CONVERT_DATA_RESOLUTION((__VREFINT_ADC_DATA__), \
Kojto 122:f9eeca106725 2160 (__ADC_RESOLUTION__), \
Kojto 122:f9eeca106725 2161 LL_ADC_RESOLUTION_12B) \
Kojto 122:f9eeca106725 2162 )
Kojto 122:f9eeca106725 2163
Kojto 122:f9eeca106725 2164 /**
Kojto 122:f9eeca106725 2165 * @brief Helper macro to calculate the temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2166 * from ADC conversion data of internal temperature sensor.
Kojto 122:f9eeca106725 2167 * @note Computation is using temperature sensor calibration values
Kojto 122:f9eeca106725 2168 * stored in system memory for each device during production.
Kojto 122:f9eeca106725 2169 * @note Calculation formula:
Kojto 122:f9eeca106725 2170 * Temperature = ((TS_ADC_DATA - TS_CAL1)
Kojto 122:f9eeca106725 2171 * * (TS_CAL2_TEMP - TS_CAL1_TEMP))
Kojto 122:f9eeca106725 2172 * / (TS_CAL2 - TS_CAL1) + TS_CAL1_TEMP
Kojto 122:f9eeca106725 2173 * with TS_ADC_DATA = temperature sensor raw data measured by ADC
Kojto 122:f9eeca106725 2174 * Avg_Slope = (TS_CAL2 - TS_CAL1)
Kojto 122:f9eeca106725 2175 * / (TS_CAL2_TEMP - TS_CAL1_TEMP)
Kojto 122:f9eeca106725 2176 * TS_CAL1 = equivalent TS_ADC_DATA at temperature
Kojto 122:f9eeca106725 2177 * TEMP_DEGC_CAL1 (calibrated in factory)
Kojto 122:f9eeca106725 2178 * TS_CAL2 = equivalent TS_ADC_DATA at temperature
Kojto 122:f9eeca106725 2179 * TEMP_DEGC_CAL2 (calibrated in factory)
Kojto 122:f9eeca106725 2180 * Caution: Calculation relevancy under reserve that calibration
Kojto 122:f9eeca106725 2181 * parameters are correct (address and data).
Kojto 122:f9eeca106725 2182 * To calculate temperature using temperature sensor
Kojto 122:f9eeca106725 2183 * datasheet typical values (generic values less, therefore
Kojto 122:f9eeca106725 2184 * less accurate than calibrated values),
Kojto 122:f9eeca106725 2185 * use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS().
Kojto 122:f9eeca106725 2186 * @note As calculation input, the analog reference voltage (Vref+) must be
Kojto 122:f9eeca106725 2187 * defined as it impacts the ADC LSB equivalent voltage.
Kojto 122:f9eeca106725 2188 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2189 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2190 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2191 * @note On this STM32 serie, calibration data of temperature sensor
Kojto 122:f9eeca106725 2192 * corresponds to a resolution of 12 bits,
Kojto 122:f9eeca106725 2193 * this is the recommended ADC resolution to convert voltage of
Kojto 122:f9eeca106725 2194 * temperature sensor.
Kojto 122:f9eeca106725 2195 * Otherwise, this macro performs the processing to scale
Kojto 122:f9eeca106725 2196 * ADC conversion data to 12 bits.
Kojto 122:f9eeca106725 2197 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2198 * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal
Kojto 122:f9eeca106725 2199 * temperature sensor (unit: digital value).
Kojto 122:f9eeca106725 2200 * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature
Kojto 122:f9eeca106725 2201 * sensor voltage has been measured.
Kojto 122:f9eeca106725 2202 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2203 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2204 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2205 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2206 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2207 * @retval Temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2208 */
Kojto 122:f9eeca106725 2209 #define __LL_ADC_CALC_TEMPERATURE(__VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2210 __TEMPSENSOR_ADC_DATA__,\
Kojto 122:f9eeca106725 2211 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2212 (((( ((int32_t)((__LL_ADC_CONVERT_DATA_RESOLUTION((__TEMPSENSOR_ADC_DATA__), \
Kojto 122:f9eeca106725 2213 (__ADC_RESOLUTION__), \
Kojto 122:f9eeca106725 2214 LL_ADC_RESOLUTION_12B) \
Kojto 122:f9eeca106725 2215 * (__VREFANALOG_VOLTAGE__)) \
Kojto 122:f9eeca106725 2216 / TEMPSENSOR_CAL_VREFANALOG) \
Kojto 122:f9eeca106725 2217 - (int32_t) *TEMPSENSOR_CAL1_ADDR) \
Kojto 122:f9eeca106725 2218 ) * (int32_t)(TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP) \
Kojto 122:f9eeca106725 2219 ) / (int32_t)((int32_t)*TEMPSENSOR_CAL2_ADDR - (int32_t)*TEMPSENSOR_CAL1_ADDR) \
Kojto 122:f9eeca106725 2220 ) + TEMPSENSOR_CAL1_TEMP \
Kojto 122:f9eeca106725 2221 )
Kojto 122:f9eeca106725 2222
Kojto 122:f9eeca106725 2223 /**
Kojto 122:f9eeca106725 2224 * @brief Helper macro to calculate the temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2225 * from ADC conversion data of internal temperature sensor.
Kojto 122:f9eeca106725 2226 * @note Computation is using temperature sensor typical values
Kojto 122:f9eeca106725 2227 * (refer to device datasheet).
Kojto 122:f9eeca106725 2228 * @note Calculation formula:
Kojto 122:f9eeca106725 2229 * Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV)
Kojto 122:f9eeca106725 2230 * / Avg_Slope + CALx_TEMP
Kojto 122:f9eeca106725 2231 * with TS_ADC_DATA = temperature sensor raw data measured by ADC
Kojto 122:f9eeca106725 2232 * (unit: digital value)
Kojto 122:f9eeca106725 2233 * Avg_Slope = temperature sensor slope
Kojto 122:f9eeca106725 2234 * (unit: uV/Degree Celsius)
Kojto 122:f9eeca106725 2235 * TS_TYP_CALx_VOLT = temperature sensor digital value at
Kojto 122:f9eeca106725 2236 * temperature CALx_TEMP (unit: mV)
Kojto 122:f9eeca106725 2237 * Caution: Calculation relevancy under reserve the temperature sensor
Kojto 122:f9eeca106725 2238 * of the current device has characteristics in line with
Kojto 122:f9eeca106725 2239 * datasheet typical values.
Kojto 122:f9eeca106725 2240 * If temperature sensor calibration values are available on
Kojto 122:f9eeca106725 2241 * on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()),
Kojto 122:f9eeca106725 2242 * temperature calculation will be more accurate using
Kojto 122:f9eeca106725 2243 * helper macro @ref __LL_ADC_CALC_TEMPERATURE().
Kojto 122:f9eeca106725 2244 * @note As calculation input, the analog reference voltage (Vref+) must be
Kojto 122:f9eeca106725 2245 * defined as it impacts the ADC LSB equivalent voltage.
Kojto 122:f9eeca106725 2246 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2247 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2248 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2249 * @note ADC measurement data must correspond to a resolution of 12bits
Kojto 122:f9eeca106725 2250 * (full scale digital value 4095). If not the case, the data must be
Kojto 122:f9eeca106725 2251 * preliminarily rescaled to an equivalent resolution of 12 bits.
Kojto 122:f9eeca106725 2252 * @param __TEMPSENSOR_TYP_AVGSLOPE__ Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius).
Kojto 122:f9eeca106725 2253 * On STM32L4, refer to device datasheet parameter "Avg_Slope".
Kojto 122:f9eeca106725 2254 * @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 2255 * On STM32L4, refer to device datasheet parameter "V30" (corresponding to TS_CAL1).
Kojto 122:f9eeca106725 2256 * @param __TEMPSENSOR_CALX_TEMP__ Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
Kojto 122:f9eeca106725 2257 * @param __VREFANALOG_VOLTAGE__ Analog voltage reference (Vref+) voltage (unit: mV)
Kojto 122:f9eeca106725 2258 * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal temperature sensor (unit: digital value).
Kojto 122:f9eeca106725 2259 * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature sensor voltage has been measured.
Kojto 122:f9eeca106725 2260 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2261 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2262 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2263 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2264 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2265 * @retval Temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2266 */
Kojto 122:f9eeca106725 2267 #define __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__,\
Kojto 122:f9eeca106725 2268 __TEMPSENSOR_TYP_CALX_V__,\
Kojto 122:f9eeca106725 2269 __TEMPSENSOR_CALX_TEMP__,\
Kojto 122:f9eeca106725 2270 __VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2271 __TEMPSENSOR_ADC_DATA__,\
Kojto 122:f9eeca106725 2272 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2273 ((( ( \
Kojto 122:f9eeca106725 2274 (int32_t)((((__TEMPSENSOR_ADC_DATA__) * (__VREFANALOG_VOLTAGE__)) \
Kojto 122:f9eeca106725 2275 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)) \
Kojto 122:f9eeca106725 2276 * 1000) \
Kojto 122:f9eeca106725 2277 - \
Kojto 122:f9eeca106725 2278 (int32_t)(((__TEMPSENSOR_TYP_CALX_V__)) \
Kojto 122:f9eeca106725 2279 * 1000) \
Kojto 122:f9eeca106725 2280 ) \
Kojto 122:f9eeca106725 2281 ) / (__TEMPSENSOR_TYP_AVGSLOPE__) \
Kojto 122:f9eeca106725 2282 ) + (__TEMPSENSOR_CALX_TEMP__) \
Kojto 122:f9eeca106725 2283 )
Kojto 122:f9eeca106725 2284
Kojto 122:f9eeca106725 2285 /**
Kojto 122:f9eeca106725 2286 * @}
Kojto 122:f9eeca106725 2287 */
Kojto 122:f9eeca106725 2288
Kojto 122:f9eeca106725 2289 /**
Kojto 122:f9eeca106725 2290 * @}
Kojto 122:f9eeca106725 2291 */
Kojto 122:f9eeca106725 2292
Kojto 122:f9eeca106725 2293
Kojto 122:f9eeca106725 2294 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 2295 /** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
Kojto 122:f9eeca106725 2296 * @{
Kojto 122:f9eeca106725 2297 */
Kojto 122:f9eeca106725 2298
Kojto 122:f9eeca106725 2299 /** @defgroup ADC_LL_EF_DMA_Management ADC DMA management
Kojto 122:f9eeca106725 2300 * @{
Kojto 122:f9eeca106725 2301 */
Kojto 122:f9eeca106725 2302 /* Note: LL ADC functions to set DMA transfer are located into sections of */
Kojto 122:f9eeca106725 2303 /* configuration of ADC instance, groups and multimode (if available): */
Kojto 122:f9eeca106725 2304 /* @ref LL_ADC_REG_SetDMATransfer(), ... */
Kojto 122:f9eeca106725 2305
Kojto 122:f9eeca106725 2306 /**
Kojto 122:f9eeca106725 2307 * @brief Function to help to configure DMA transfer from ADC: retrieve the
Kojto 122:f9eeca106725 2308 * ADC register address from ADC instance and a list of ADC registers
Kojto 122:f9eeca106725 2309 * intended to be used (most commonly) with DMA transfer.
Kojto 122:f9eeca106725 2310 * @note These ADC registers are data registers:
Kojto 122:f9eeca106725 2311 * when ADC conversion data is available in ADC data registers,
Kojto 122:f9eeca106725 2312 * ADC generates a DMA transfer request.
Kojto 122:f9eeca106725 2313 * @note This macro is intended to be used with LL DMA driver, refer to
Kojto 122:f9eeca106725 2314 * function "LL_DMA_ConfigAddresses()".
Kojto 122:f9eeca106725 2315 * Example:
Kojto 122:f9eeca106725 2316 * LL_DMA_ConfigAddresses(DMA1,
Kojto 122:f9eeca106725 2317 * LL_DMA_CHANNEL_1,
Kojto 122:f9eeca106725 2318 * LL_ADC_DMA_GetRegAddr(ADC1, LL_ADC_DMA_REG_REGULAR_DATA),
Kojto 122:f9eeca106725 2319 * (uint32_t)&< array or variable >,
Kojto 122:f9eeca106725 2320 * LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
Kojto 122:f9eeca106725 2321 * @note For devices with several ADC: in multimode, some devices
Kojto 122:f9eeca106725 2322 * use a different data register outside of ADC instance scope
Kojto 122:f9eeca106725 2323 * (common data register). This macro manages this register difference,
Kojto 122:f9eeca106725 2324 * only ADC instance has to be set as parameter.
Kojto 122:f9eeca106725 2325 * @rmtoll DR RDATA LL_ADC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 2326 * CDR RDATA_MST LL_ADC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 2327 * CDR RDATA_SLV LL_ADC_DMA_GetRegAddr
Kojto 122:f9eeca106725 2328 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2329 * @param Register This parameter can be one of the following values:
Kojto 122:f9eeca106725 2330 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA
Kojto 122:f9eeca106725 2331 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA_MULTI (1)
Kojto 122:f9eeca106725 2332 *
Kojto 122:f9eeca106725 2333 * (1) Available on devices with several ADC instances.
Kojto 122:f9eeca106725 2334 * @retval ADC register address
Kojto 122:f9eeca106725 2335 */
Kojto 122:f9eeca106725 2336 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 2337 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
Kojto 122:f9eeca106725 2338 {
Kojto 122:f9eeca106725 2339 register uint32_t data_reg_addr = 0U;
Kojto 122:f9eeca106725 2340
Kojto 122:f9eeca106725 2341 if (Register == LL_ADC_DMA_REG_REGULAR_DATA)
Kojto 122:f9eeca106725 2342 {
Kojto 122:f9eeca106725 2343 /* Retrieve address of register DR */
Kojto 122:f9eeca106725 2344 data_reg_addr = (uint32_t)&(ADCx->DR);
Kojto 122:f9eeca106725 2345 }
Kojto 122:f9eeca106725 2346 else /* (Register == LL_ADC_DMA_REG_REGULAR_DATA_MULTI) */
Kojto 122:f9eeca106725 2347 {
Kojto 122:f9eeca106725 2348 /* Retrieve address of register CDR */
Kojto 122:f9eeca106725 2349 data_reg_addr = (uint32_t)&((__LL_ADC_COMMON_INSTANCE(ADCx))->CDR);
Kojto 122:f9eeca106725 2350 }
Kojto 122:f9eeca106725 2351
Kojto 122:f9eeca106725 2352 return data_reg_addr;
Kojto 122:f9eeca106725 2353 }
Kojto 122:f9eeca106725 2354 #else
Kojto 122:f9eeca106725 2355 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
Kojto 122:f9eeca106725 2356 {
Kojto 122:f9eeca106725 2357 /* Retrieve address of register DR */
Kojto 122:f9eeca106725 2358 return (uint32_t)&(ADCx->DR);
Kojto 122:f9eeca106725 2359 }
Kojto 122:f9eeca106725 2360 #endif
Kojto 122:f9eeca106725 2361
Kojto 122:f9eeca106725 2362 /**
Kojto 122:f9eeca106725 2363 * @}
Kojto 122:f9eeca106725 2364 */
Kojto 122:f9eeca106725 2365
Kojto 122:f9eeca106725 2366 /** @defgroup ADC_LL_EF_Configuration_ADC_Common Configuration of ADC hierarchical scope: common to several ADC instances
Kojto 122:f9eeca106725 2367 * @{
Kojto 122:f9eeca106725 2368 */
Kojto 122:f9eeca106725 2369
Kojto 122:f9eeca106725 2370 /**
Kojto 122:f9eeca106725 2371 * @brief Set parameter common to several ADC: Clock source and prescaler.
Kojto 122:f9eeca106725 2372 * @note On this STM32 serie, if ADC group injected is used, some
Kojto 122:f9eeca106725 2373 * clock ratio constraints between ADC clock and AHB clock
Kojto 122:f9eeca106725 2374 * must be respected.
Kojto 122:f9eeca106725 2375 * Refer to reference manual.
Kojto 122:f9eeca106725 2376 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2377 * ADC state:
Kojto 122:f9eeca106725 2378 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2379 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 2380 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 2381 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 2382 * @rmtoll CCR CKMODE LL_ADC_SetCommonClock\n
Kojto 122:f9eeca106725 2383 * CCR PRESC LL_ADC_SetCommonClock
Kojto 122:f9eeca106725 2384 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2385 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2386 * @param CommonClock This parameter can be one of the following values:
Kojto 122:f9eeca106725 2387 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
Kojto 122:f9eeca106725 2388 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
Kojto 122:f9eeca106725 2389 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
Kojto 122:f9eeca106725 2390 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
Kojto 122:f9eeca106725 2391 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
Kojto 122:f9eeca106725 2392 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
Kojto 122:f9eeca106725 2393 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
Kojto 122:f9eeca106725 2394 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
Kojto 122:f9eeca106725 2395 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
Kojto 122:f9eeca106725 2396 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
Kojto 122:f9eeca106725 2397 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
Kojto 122:f9eeca106725 2398 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
Kojto 122:f9eeca106725 2399 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
Kojto 122:f9eeca106725 2400 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
Kojto 122:f9eeca106725 2401 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
Kojto 122:f9eeca106725 2402 * @retval None
Kojto 122:f9eeca106725 2403 */
Kojto 122:f9eeca106725 2404 __STATIC_INLINE void LL_ADC_SetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonClock)
Kojto 122:f9eeca106725 2405 {
Kojto 122:f9eeca106725 2406 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC, CommonClock);
Kojto 122:f9eeca106725 2407 }
Kojto 122:f9eeca106725 2408
Kojto 122:f9eeca106725 2409 /**
Kojto 122:f9eeca106725 2410 * @brief Get parameter common to several ADC: Clock source and prescaler.
Kojto 122:f9eeca106725 2411 * @rmtoll CCR CKMODE LL_ADC_GetCommonClock\n
Kojto 122:f9eeca106725 2412 * CCR PRESC LL_ADC_GetCommonClock
Kojto 122:f9eeca106725 2413 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2414 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2415 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2416 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
Kojto 122:f9eeca106725 2417 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
Kojto 122:f9eeca106725 2418 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
Kojto 122:f9eeca106725 2419 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
Kojto 122:f9eeca106725 2420 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
Kojto 122:f9eeca106725 2421 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
Kojto 122:f9eeca106725 2422 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
Kojto 122:f9eeca106725 2423 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
Kojto 122:f9eeca106725 2424 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
Kojto 122:f9eeca106725 2425 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
Kojto 122:f9eeca106725 2426 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
Kojto 122:f9eeca106725 2427 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
Kojto 122:f9eeca106725 2428 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
Kojto 122:f9eeca106725 2429 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
Kojto 122:f9eeca106725 2430 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
Kojto 122:f9eeca106725 2431 */
Kojto 122:f9eeca106725 2432 __STATIC_INLINE uint32_t LL_ADC_GetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 2433 {
Kojto 122:f9eeca106725 2434 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC));
Kojto 122:f9eeca106725 2435 }
Kojto 122:f9eeca106725 2436
Kojto 122:f9eeca106725 2437 /**
Kojto 122:f9eeca106725 2438 * @brief Set parameter common to several ADC: measurement path to internal
Kojto 122:f9eeca106725 2439 * channels (VrefInt, temperature sensor, ...).
Kojto 122:f9eeca106725 2440 * @note One or several values can be selected.
Kojto 122:f9eeca106725 2441 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
Kojto 122:f9eeca106725 2442 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
Kojto 122:f9eeca106725 2443 * @note Stabilization time of measurement path to internal channel:
Kojto 122:f9eeca106725 2444 * After enabling internal paths, before starting ADC conversion,
Kojto 122:f9eeca106725 2445 * a delay is required for internal voltage reference and
Kojto 122:f9eeca106725 2446 * temperature sensor stabilization time.
Kojto 122:f9eeca106725 2447 * Refer to device datasheet.
Kojto 122:f9eeca106725 2448 * Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
Kojto 122:f9eeca106725 2449 * Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
Kojto 122:f9eeca106725 2450 * @note ADC internal channel sampling time constraint:
Kojto 122:f9eeca106725 2451 * For ADC conversion of internal channels,
Kojto 122:f9eeca106725 2452 * a sampling time minimum value is required.
Kojto 122:f9eeca106725 2453 * Refer to device datasheet.
Kojto 122:f9eeca106725 2454 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2455 * ADC state:
Kojto 122:f9eeca106725 2456 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2457 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 2458 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 2459 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 2460 * @rmtoll CCR VREFEN LL_ADC_SetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2461 * CCR TSEN LL_ADC_SetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2462 * CCR VBATEN LL_ADC_SetCommonPathInternalCh
Kojto 122:f9eeca106725 2463 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2464 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2465 * @param PathInternal This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 2466 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
Kojto 122:f9eeca106725 2467 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
Kojto 122:f9eeca106725 2468 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
Kojto 122:f9eeca106725 2469 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
Kojto 122:f9eeca106725 2470 * @retval None
Kojto 122:f9eeca106725 2471 */
Kojto 122:f9eeca106725 2472 __STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
Kojto 122:f9eeca106725 2473 {
Kojto 122:f9eeca106725 2474 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN, PathInternal);
Kojto 122:f9eeca106725 2475 }
Kojto 122:f9eeca106725 2476
Kojto 122:f9eeca106725 2477 /**
Kojto 122:f9eeca106725 2478 * @brief Get parameter common to several ADC: measurement path to internal
Kojto 122:f9eeca106725 2479 * channels (VrefInt, temperature sensor, ...).
Kojto 122:f9eeca106725 2480 * @note One or several values can be selected.
Kojto 122:f9eeca106725 2481 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
Kojto 122:f9eeca106725 2482 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
Kojto 122:f9eeca106725 2483 * @rmtoll CCR VREFEN LL_ADC_GetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2484 * CCR TSEN LL_ADC_GetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2485 * CCR VBATEN LL_ADC_GetCommonPathInternalCh
Kojto 122:f9eeca106725 2486 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2487 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2488 * @retval Returned value can be a combination of the following values:
Kojto 122:f9eeca106725 2489 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
Kojto 122:f9eeca106725 2490 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
Kojto 122:f9eeca106725 2491 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
Kojto 122:f9eeca106725 2492 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
Kojto 122:f9eeca106725 2493 */
Kojto 122:f9eeca106725 2494 __STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 2495 {
Kojto 122:f9eeca106725 2496 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN));
Kojto 122:f9eeca106725 2497 }
Kojto 122:f9eeca106725 2498
Kojto 122:f9eeca106725 2499 /**
Kojto 122:f9eeca106725 2500 * @}
Kojto 122:f9eeca106725 2501 */
Kojto 122:f9eeca106725 2502
Kojto 122:f9eeca106725 2503 /** @defgroup ADC_LL_EF_Configuration_ADC_Instance Configuration of ADC hierarchical scope: ADC instance
Kojto 122:f9eeca106725 2504 * @{
Kojto 122:f9eeca106725 2505 */
Kojto 122:f9eeca106725 2506
Kojto 122:f9eeca106725 2507 /**
Kojto 122:f9eeca106725 2508 * @brief Set ADC calibration factor in the mode single-ended
Kojto 122:f9eeca106725 2509 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 2510 * @note This function is intended to set calibration parameters
Kojto 122:f9eeca106725 2511 * without having to perform a new calibration using
Kojto 122:f9eeca106725 2512 * @ref LL_ADC_StartCalibration().
Kojto 122:f9eeca106725 2513 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 2514 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 2515 * single-ended and differential modes
Kojto 122:f9eeca106725 2516 * (calibration factor must be specified for each of these
Kojto 122:f9eeca106725 2517 * differential modes, if used afterwards and if the application
Kojto 122:f9eeca106725 2518 * requires their calibration).
Kojto 122:f9eeca106725 2519 * @note In case of setting calibration factors of both modes single ended
Kojto 122:f9eeca106725 2520 * and differential (parameter LL_ADC_BOTH_SINGLE_DIFF_ENDED):
Kojto 122:f9eeca106725 2521 * both calibration factors must be concatenated.
Kojto 122:f9eeca106725 2522 * To perform this processing, use helper macro
Kojto 122:f9eeca106725 2523 * @ref __LL_ADC_CALIB_FACTOR_SINGLE_DIFF().
Kojto 122:f9eeca106725 2524 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2525 * ADC state:
Kojto 122:f9eeca106725 2526 * ADC must be enabled, without calibration on going, without conversion
Kojto 122:f9eeca106725 2527 * on going on group regular.
Kojto 122:f9eeca106725 2528 * @rmtoll CALFACT CALFACT_S LL_ADC_SetCalibrationFactor\n
Kojto 122:f9eeca106725 2529 * CALFACT CALFACT_D LL_ADC_SetCalibrationFactor
Kojto 122:f9eeca106725 2530 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2531 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 2532 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 2533 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 2534 * @arg @ref LL_ADC_BOTH_SINGLE_DIFF_ENDED
Kojto 122:f9eeca106725 2535 * @param CalibrationFactor Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2536 * @retval None
Kojto 122:f9eeca106725 2537 */
Kojto 122:f9eeca106725 2538 __STATIC_INLINE void LL_ADC_SetCalibrationFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff, uint32_t CalibrationFactor)
Kojto 122:f9eeca106725 2539 {
Kojto 122:f9eeca106725 2540 MODIFY_REG(ADCx->CALFACT,
Kojto 122:f9eeca106725 2541 SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK,
Kojto 122:f9eeca106725 2542 CalibrationFactor << POSITION_VAL(SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK));
Kojto 122:f9eeca106725 2543 }
Kojto 122:f9eeca106725 2544
Kojto 122:f9eeca106725 2545 /**
Kojto 122:f9eeca106725 2546 * @brief Get ADC calibration factor in the mode single-ended
Kojto 122:f9eeca106725 2547 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 2548 * @note Calibration factors are set by hardware after performing
Kojto 122:f9eeca106725 2549 * a calibration run using function @ref LL_ADC_StartCalibration().
Kojto 122:f9eeca106725 2550 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 2551 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 2552 * single-ended and differential modes
Kojto 122:f9eeca106725 2553 * @rmtoll CALFACT CALFACT_S LL_ADC_GetCalibrationFactor\n
Kojto 122:f9eeca106725 2554 * CALFACT CALFACT_D LL_ADC_GetCalibrationFactor
Kojto 122:f9eeca106725 2555 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2556 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 2557 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 2558 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 2559 * @retval Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2560 */
Kojto 122:f9eeca106725 2561 __STATIC_INLINE uint32_t LL_ADC_GetCalibrationFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff)
Kojto 122:f9eeca106725 2562 {
Kojto 122:f9eeca106725 2563 /* Retrieve bits with position in register depending on parameter */
Kojto 122:f9eeca106725 2564 /* "SingleDiff". */
Kojto 122:f9eeca106725 2565 /* Parameter used with mask "ADC_SINGLEDIFF_CALIB_FACTOR_MASK" because */
Kojto 122:f9eeca106725 2566 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 2567 return (uint32_t)(READ_BIT(ADCx->CALFACT, (SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK)) >> POSITION_VAL(SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK));
Kojto 122:f9eeca106725 2568 }
Kojto 122:f9eeca106725 2569
Kojto 122:f9eeca106725 2570 /**
Kojto 122:f9eeca106725 2571 * @brief Set ADC resolution.
Kojto 122:f9eeca106725 2572 * Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2573 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2574 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2575 * ADC state:
Kojto 122:f9eeca106725 2576 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2577 * on either groups regular or injected.
Kojto 122:f9eeca106725 2578 * @rmtoll CFGR RES LL_ADC_SetResolution
Kojto 122:f9eeca106725 2579 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2580 * @param Resolution This parameter can be one of the following values:
Kojto 122:f9eeca106725 2581 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2582 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2583 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2584 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2585 * @retval None
Kojto 122:f9eeca106725 2586 */
Kojto 122:f9eeca106725 2587 __STATIC_INLINE void LL_ADC_SetResolution(ADC_TypeDef *ADCx, uint32_t Resolution)
Kojto 122:f9eeca106725 2588 {
Kojto 122:f9eeca106725 2589 MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
Kojto 122:f9eeca106725 2590 }
Kojto 122:f9eeca106725 2591
Kojto 122:f9eeca106725 2592 /**
Kojto 122:f9eeca106725 2593 * @brief Get 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 * @rmtoll CFGR RES LL_ADC_GetResolution
Kojto 122:f9eeca106725 2597 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2598 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2599 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2600 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2601 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2602 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2603 */
Kojto 122:f9eeca106725 2604 __STATIC_INLINE uint32_t LL_ADC_GetResolution(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2605 {
Kojto 122:f9eeca106725 2606 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
Kojto 122:f9eeca106725 2607 }
Kojto 122:f9eeca106725 2608
Kojto 122:f9eeca106725 2609 /**
Kojto 122:f9eeca106725 2610 * @brief Set ADC conversion data alignment.
Kojto 122:f9eeca106725 2611 * @note Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2612 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2613 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2614 * ADC state:
Kojto 122:f9eeca106725 2615 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2616 * on either groups regular or injected.
Kojto 122:f9eeca106725 2617 * @rmtoll CFGR ALIGN LL_ADC_SetDataAlignment
Kojto 122:f9eeca106725 2618 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2619 * @param DataAlignment This parameter can be one of the following values:
Kojto 122:f9eeca106725 2620 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
Kojto 122:f9eeca106725 2621 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
Kojto 122:f9eeca106725 2622 * @retval None
Kojto 122:f9eeca106725 2623 */
Kojto 122:f9eeca106725 2624 __STATIC_INLINE void LL_ADC_SetDataAlignment(ADC_TypeDef *ADCx, uint32_t DataAlignment)
Kojto 122:f9eeca106725 2625 {
Kojto 122:f9eeca106725 2626 MODIFY_REG(ADCx->CFGR, ADC_CFGR_ALIGN, DataAlignment);
Kojto 122:f9eeca106725 2627 }
Kojto 122:f9eeca106725 2628
Kojto 122:f9eeca106725 2629 /**
Kojto 122:f9eeca106725 2630 * @brief Get ADC conversion data alignment.
Kojto 122:f9eeca106725 2631 * @note Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2632 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2633 * @rmtoll CFGR ALIGN LL_ADC_GetDataAlignment
Kojto 122:f9eeca106725 2634 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2635 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2636 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
Kojto 122:f9eeca106725 2637 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
Kojto 122:f9eeca106725 2638 */
Kojto 122:f9eeca106725 2639 __STATIC_INLINE uint32_t LL_ADC_GetDataAlignment(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2640 {
Kojto 122:f9eeca106725 2641 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_ALIGN));
Kojto 122:f9eeca106725 2642 }
Kojto 122:f9eeca106725 2643
Kojto 122:f9eeca106725 2644 /**
Kojto 122:f9eeca106725 2645 * @brief Set ADC low power mode.
Kojto 122:f9eeca106725 2646 * @note Description of ADC low power modes:
Kojto 122:f9eeca106725 2647 * - ADC low power mode "auto wait": Dynamic low power mode,
Kojto 122:f9eeca106725 2648 * ADC conversions occurrences are limited to the minimum necessary
Kojto 122:f9eeca106725 2649 * in order to reduce power consumption.
Kojto 122:f9eeca106725 2650 * New ADC conversion starts only when the previous
Kojto 122:f9eeca106725 2651 * unitary conversion data (for ADC group regular)
Kojto 122:f9eeca106725 2652 * or previous sequence conversions data (for ADC group injected)
Kojto 122:f9eeca106725 2653 * has been retrieved by user software.
Kojto 122:f9eeca106725 2654 * In the meantime, ADC remains idle: does not performs any
Kojto 122:f9eeca106725 2655 * other conversion.
Kojto 122:f9eeca106725 2656 * This mode allows to automatically adapt the ADC conversions
Kojto 122:f9eeca106725 2657 * triggers to the speed of the software that reads the data.
Kojto 122:f9eeca106725 2658 * Moreover, this avoids risk of overrun for low frequency
Kojto 122:f9eeca106725 2659 * applications.
Kojto 122:f9eeca106725 2660 * How to use this low power mode:
Kojto 122:f9eeca106725 2661 * - Do not use with interruption or DMA since these modes
Kojto 122:f9eeca106725 2662 * have to clear immediately the EOC flag to free the
Kojto 122:f9eeca106725 2663 * IRQ vector sequencer.
Kojto 122:f9eeca106725 2664 * - Do use with polling: 1. Start conversion,
Kojto 122:f9eeca106725 2665 * 2. Later on, when conversion data is needed: poll for end of
Kojto 122:f9eeca106725 2666 * conversion to ensure that conversion is completed and
Kojto 122:f9eeca106725 2667 * retrieve ADC conversion data. This will trig another
Kojto 122:f9eeca106725 2668 * ADC conversion start.
Kojto 122:f9eeca106725 2669 * - ADC low power mode "auto power-off" (feature available on
Kojto 122:f9eeca106725 2670 * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
Kojto 122:f9eeca106725 2671 * the ADC automatically powers-off after a conversion and
Kojto 122:f9eeca106725 2672 * automatically wakes up when a new conversion is triggered
Kojto 122:f9eeca106725 2673 * (with startup time between trigger and start of sampling).
Kojto 122:f9eeca106725 2674 * This feature can be combined with low power mode "auto wait".
Kojto 122:f9eeca106725 2675 * @note With ADC low power mode "auto wait", the ADC conversion data read
Kojto 122:f9eeca106725 2676 * is corresponding to previous ADC conversion start, independently
Kojto 122:f9eeca106725 2677 * of delay during which ADC was idle.
Kojto 122:f9eeca106725 2678 * Therefore, the ADC conversion data may be outdated: does not
Kojto 122:f9eeca106725 2679 * correspond to the current voltage level on the selected
Kojto 122:f9eeca106725 2680 * ADC channel.
Kojto 122:f9eeca106725 2681 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2682 * ADC state:
Kojto 122:f9eeca106725 2683 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2684 * on either groups regular or injected.
Kojto 122:f9eeca106725 2685 * @rmtoll CFGR AUTDLY LL_ADC_SetLowPowerMode
Kojto 122:f9eeca106725 2686 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2687 * @param LowPowerMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 2688 * @arg @ref LL_ADC_LP_MODE_NONE
Kojto 122:f9eeca106725 2689 * @arg @ref LL_ADC_LP_AUTOWAIT
Kojto 122:f9eeca106725 2690 * @retval None
Kojto 122:f9eeca106725 2691 */
Kojto 122:f9eeca106725 2692 __STATIC_INLINE void LL_ADC_SetLowPowerMode(ADC_TypeDef *ADCx, uint32_t LowPowerMode)
Kojto 122:f9eeca106725 2693 {
Kojto 122:f9eeca106725 2694 MODIFY_REG(ADCx->CFGR, ADC_CFGR_AUTDLY, LowPowerMode);
Kojto 122:f9eeca106725 2695 }
Kojto 122:f9eeca106725 2696
Kojto 122:f9eeca106725 2697 /**
Kojto 122:f9eeca106725 2698 * @brief Get ADC low power mode:
Kojto 122:f9eeca106725 2699 * @note Description of ADC low power modes:
Kojto 122:f9eeca106725 2700 * - ADC low power mode "auto wait": Dynamic low power mode,
Kojto 122:f9eeca106725 2701 * ADC conversions occurrences are limited to the minimum necessary
Kojto 122:f9eeca106725 2702 * in order to reduce power consumption.
Kojto 122:f9eeca106725 2703 * New ADC conversion starts only when the previous
Kojto 122:f9eeca106725 2704 * unitary conversion data (for ADC group regular)
Kojto 122:f9eeca106725 2705 * or previous sequence conversions data (for ADC group injected)
Kojto 122:f9eeca106725 2706 * has been retrieved by user software.
Kojto 122:f9eeca106725 2707 * In the meantime, ADC remains idle: does not performs any
Kojto 122:f9eeca106725 2708 * other conversion.
Kojto 122:f9eeca106725 2709 * This mode allows to automatically adapt the ADC conversions
Kojto 122:f9eeca106725 2710 * triggers to the speed of the software that reads the data.
Kojto 122:f9eeca106725 2711 * Moreover, this avoids risk of overrun for low frequency
Kojto 122:f9eeca106725 2712 * applications.
Kojto 122:f9eeca106725 2713 * How to use this low power mode:
Kojto 122:f9eeca106725 2714 * - Do not use with interruption or DMA since these modes
Kojto 122:f9eeca106725 2715 * have to clear immediately the EOC flag to free the
Kojto 122:f9eeca106725 2716 * IRQ vector sequencer.
Kojto 122:f9eeca106725 2717 * - Do use with polling: 1. Start conversion,
Kojto 122:f9eeca106725 2718 * 2. Later on, when conversion data is needed: poll for end of
Kojto 122:f9eeca106725 2719 * conversion to ensure that conversion is completed and
Kojto 122:f9eeca106725 2720 * retrieve ADC conversion data. This will trig another
Kojto 122:f9eeca106725 2721 * ADC conversion start.
Kojto 122:f9eeca106725 2722 * - ADC low power mode "auto power-off" (feature available on
Kojto 122:f9eeca106725 2723 * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
Kojto 122:f9eeca106725 2724 * the ADC automatically powers-off after a conversion and
Kojto 122:f9eeca106725 2725 * automatically wakes up when a new conversion is triggered
Kojto 122:f9eeca106725 2726 * (with startup time between trigger and start of sampling).
Kojto 122:f9eeca106725 2727 * This feature can be combined with low power mode "auto wait".
Kojto 122:f9eeca106725 2728 * @note With ADC low power mode "auto wait", the ADC conversion data read
Kojto 122:f9eeca106725 2729 * is corresponding to previous ADC conversion start, independently
Kojto 122:f9eeca106725 2730 * of delay during which ADC was idle.
Kojto 122:f9eeca106725 2731 * Therefore, the ADC conversion data may be outdated: does not
Kojto 122:f9eeca106725 2732 * correspond to the current voltage level on the selected
Kojto 122:f9eeca106725 2733 * ADC channel.
Kojto 122:f9eeca106725 2734 * @rmtoll CFGR AUTDLY LL_ADC_GetLowPowerMode
Kojto 122:f9eeca106725 2735 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2736 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2737 * @arg @ref LL_ADC_LP_MODE_NONE
Kojto 122:f9eeca106725 2738 * @arg @ref LL_ADC_LP_AUTOWAIT
Kojto 122:f9eeca106725 2739 */
Kojto 122:f9eeca106725 2740 __STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2741 {
Kojto 122:f9eeca106725 2742 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_AUTDLY));
Kojto 122:f9eeca106725 2743 }
Kojto 122:f9eeca106725 2744
Kojto 122:f9eeca106725 2745 /**
Kojto 122:f9eeca106725 2746 * @brief Set ADC selected offset number 1, 2, 3 or 4.
Kojto 122:f9eeca106725 2747 * @note This function set the 2 items of offset configuration:
Kojto 122:f9eeca106725 2748 * - ADC channel to which the offset programmed will be applied
Kojto 122:f9eeca106725 2749 * (independently of channel mapped on ADC group regular
Kojto 122:f9eeca106725 2750 * or group injected)
Kojto 122:f9eeca106725 2751 * - Offset level (offset to be subtracted from the raw
Kojto 122:f9eeca106725 2752 * converted data).
Kojto 122:f9eeca106725 2753 * @note Caution: Offset format is dependent to ADC resolution:
Kojto 122:f9eeca106725 2754 * offset has to be left-aligned on bit 11, the LSB (right bits)
Kojto 122:f9eeca106725 2755 * are set to 0.
Kojto 122:f9eeca106725 2756 * @note This function enables the offset, by default. It can be forced
Kojto 122:f9eeca106725 2757 * to disable state using function LL_ADC_SetOffsetState().
Kojto 122:f9eeca106725 2758 * @note If a channel is mapped on several offsets numbers, only the offset
Kojto 122:f9eeca106725 2759 * with the lowest value is considered for the subtraction.
Kojto 122:f9eeca106725 2760 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2761 * ADC state:
Kojto 122:f9eeca106725 2762 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2763 * on either groups regular or injected.
Kojto 122:f9eeca106725 2764 * @note On STM32L4, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 2765 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 2766 * @rmtoll OFR1 OFFSET1_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2767 * OFR1 OFFSET1 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2768 * OFR1 OFFSET1_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2769 * OFR2 OFFSET2_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2770 * OFR2 OFFSET2 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2771 * OFR2 OFFSET2_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2772 * OFR3 OFFSET3_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2773 * OFR3 OFFSET3 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2774 * OFR3 OFFSET3_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2775 * OFR4 OFFSET4_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2776 * OFR4 OFFSET4 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2777 * OFR4 OFFSET4_EN LL_ADC_SetOffset
Kojto 122:f9eeca106725 2778 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2779 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2780 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2781 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2782 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2783 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2784 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 2785 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 2786 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 2787 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 2788 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 2789 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 2790 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 2791 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 2792 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 2793 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 2794 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 2795 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 2796 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 2797 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 2798 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 2799 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 2800 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 2801 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 2802 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 2803 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 2804 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 2805 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 2806 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 2807 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 2808 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 2809 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 2810 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 2811 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 2812 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 2813 *
Kojto 122:f9eeca106725 2814 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 2815 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 2816 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 2817 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 2818 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 2819 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 2820 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 2821 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 2822 * @param OffsetLevel Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2823 * @retval None
Kojto 122:f9eeca106725 2824 */
Kojto 122:f9eeca106725 2825 __STATIC_INLINE void LL_ADC_SetOffset(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t Channel, uint32_t OffsetLevel)
Kojto 122:f9eeca106725 2826 {
Kojto 122:f9eeca106725 2827 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2828
Kojto 122:f9eeca106725 2829 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 2830 ADC_OFR1_OFFSET1_EN | ADC_OFR1_OFFSET1_CH | ADC_OFR1_OFFSET1,
Kojto 122:f9eeca106725 2831 ADC_OFR1_OFFSET1_EN | (Channel & ADC_CHANNEL_ID_NUMBER_MASK) | OffsetLevel);
Kojto 122:f9eeca106725 2832 }
Kojto 122:f9eeca106725 2833
Kojto 122:f9eeca106725 2834 /**
Kojto 122:f9eeca106725 2835 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2836 * Channel to which the offset programmed will be applied
Kojto 122:f9eeca106725 2837 * (independently of channel mapped on ADC group regular
Kojto 122:f9eeca106725 2838 * or group injected)
Kojto 122:f9eeca106725 2839 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 2840 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 2841 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 2842 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 2843 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 2844 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 2845 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 2846 * as parameter for another function.
Kojto 122:f9eeca106725 2847 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 2848 * process the returned value with the helper macro
Kojto 122:f9eeca106725 2849 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 2850 * @note On STM32L4, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 2851 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 2852 * @rmtoll OFR1 OFFSET1_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2853 * OFR2 OFFSET2_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2854 * OFR3 OFFSET3_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2855 * OFR4 OFFSET4_CH LL_ADC_GetOffsetChannel
Kojto 122:f9eeca106725 2856 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2857 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2858 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2859 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2860 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2861 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2862 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2863 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 2864 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 2865 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 2866 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 2867 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 2868 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 2869 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 2870 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 2871 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 2872 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 2873 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 2874 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 2875 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 2876 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 2877 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 2878 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 2879 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 2880 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 2881 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 2882 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 2883 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 2884 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 2885 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 2886 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 2887 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 2888 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 2889 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 2890 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 2891 *
Kojto 122:f9eeca106725 2892 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 2893 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 2894 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 2895 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 2896 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 2897 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 2898 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 2899 * 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 2900 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 2901 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 2902 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 2903 */
Kojto 122:f9eeca106725 2904 __STATIC_INLINE uint32_t LL_ADC_GetOffsetChannel(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 2905 {
Kojto 122:f9eeca106725 2906 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2907
Kojto 122:f9eeca106725 2908 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_CH);
Kojto 122:f9eeca106725 2909 }
Kojto 122:f9eeca106725 2910
Kojto 122:f9eeca106725 2911 /**
Kojto 122:f9eeca106725 2912 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2913 * Offset level (offset to be subtracted from the raw
Kojto 122:f9eeca106725 2914 * converted data).
Kojto 122:f9eeca106725 2915 * @note Caution: Offset format is dependent to ADC resolution:
Kojto 122:f9eeca106725 2916 * offset has to be left-aligned on bit 11, the LSB (right bits)
Kojto 122:f9eeca106725 2917 * are set to 0.
Kojto 122:f9eeca106725 2918 * @rmtoll OFR1 OFFSET1 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2919 * OFR2 OFFSET2 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2920 * OFR3 OFFSET3 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2921 * OFR4 OFFSET4 LL_ADC_GetOffsetLevel
Kojto 122:f9eeca106725 2922 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2923 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2924 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2925 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2926 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2927 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2928 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2929 */
Kojto 122:f9eeca106725 2930 __STATIC_INLINE uint32_t LL_ADC_GetOffsetLevel(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 2931 {
Kojto 122:f9eeca106725 2932 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2933
Kojto 122:f9eeca106725 2934 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1);
Kojto 122:f9eeca106725 2935 }
Kojto 122:f9eeca106725 2936
Kojto 122:f9eeca106725 2937 /**
Kojto 122:f9eeca106725 2938 * @brief Set for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2939 * force offset state disable or enable
Kojto 122:f9eeca106725 2940 * without modifying offset channel or offset value.
Kojto 122:f9eeca106725 2941 * @note This function should be needed only in case of offset to be
Kojto 122:f9eeca106725 2942 * enabled-disabled dynamically, and should not be needed in other cases:
Kojto 122:f9eeca106725 2943 * function LL_ADC_SetOffset() automatically enables the offset.
Kojto 122:f9eeca106725 2944 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2945 * ADC state:
Kojto 122:f9eeca106725 2946 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2947 * on either groups regular or injected.
Kojto 122:f9eeca106725 2948 * @rmtoll OFR1 OFFSET1_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2949 * OFR2 OFFSET2_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2950 * OFR3 OFFSET3_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2951 * OFR4 OFFSET4_EN LL_ADC_SetOffsetState
Kojto 122:f9eeca106725 2952 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2953 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2954 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2955 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2956 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2957 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2958 * @param OffsetState This parameter can be one of the following values:
Kojto 122:f9eeca106725 2959 * @arg @ref LL_ADC_OFFSET_DISABLE
Kojto 122:f9eeca106725 2960 * @arg @ref LL_ADC_OFFSET_ENABLE
Kojto 122:f9eeca106725 2961 * @retval None
Kojto 122:f9eeca106725 2962 */
Kojto 122:f9eeca106725 2963 __STATIC_INLINE void LL_ADC_SetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetState)
Kojto 122:f9eeca106725 2964 {
Kojto 122:f9eeca106725 2965 register uint32_t *preg = (uint32_t *)((uint32_t)
Kojto 122:f9eeca106725 2966 ((uint32_t)(&ADCx->OFR1) + (Offsety*4U)));
Kojto 122:f9eeca106725 2967
Kojto 122:f9eeca106725 2968 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 2969 ADC_OFR1_OFFSET1_EN,
Kojto 122:f9eeca106725 2970 OffsetState);
Kojto 122:f9eeca106725 2971 }
Kojto 122:f9eeca106725 2972
Kojto 122:f9eeca106725 2973 /**
Kojto 122:f9eeca106725 2974 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2975 * offset state disabled or enabled.
Kojto 122:f9eeca106725 2976 * @rmtoll OFR1 OFFSET1_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 2977 * OFR2 OFFSET2_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 2978 * OFR3 OFFSET3_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 2979 * OFR4 OFFSET4_EN LL_ADC_GetOffsetState
Kojto 122:f9eeca106725 2980 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2981 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2982 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2983 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2984 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2985 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2986 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2987 * @arg @ref LL_ADC_OFFSET_DISABLE
Kojto 122:f9eeca106725 2988 * @arg @ref LL_ADC_OFFSET_ENABLE
Kojto 122:f9eeca106725 2989 */
Kojto 122:f9eeca106725 2990 __STATIC_INLINE uint32_t LL_ADC_GetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 2991 {
Kojto 122:f9eeca106725 2992 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2993
Kojto 122:f9eeca106725 2994 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_EN);
Kojto 122:f9eeca106725 2995 }
Kojto 122:f9eeca106725 2996
Kojto 122:f9eeca106725 2997 /**
Kojto 122:f9eeca106725 2998 * @}
Kojto 122:f9eeca106725 2999 */
Kojto 122:f9eeca106725 3000
Kojto 122:f9eeca106725 3001 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Regular Configuration of ADC hierarchical scope: group regular
Kojto 122:f9eeca106725 3002 * @{
Kojto 122:f9eeca106725 3003 */
Kojto 122:f9eeca106725 3004
Kojto 122:f9eeca106725 3005 /**
Kojto 122:f9eeca106725 3006 * @brief Set ADC group regular conversion trigger source:
Kojto 122:f9eeca106725 3007 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3008 * external interrupt line).
Kojto 122:f9eeca106725 3009 * @note On this STM32 serie, setting trigger source to external trigger
Kojto 122:f9eeca106725 3010 * also set trigger polarity to rising edge
Kojto 122:f9eeca106725 3011 * (default setting for compatibility with some ADC on other
Kojto 122:f9eeca106725 3012 * STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 3013 * In case of need to modify trigger edge, use
Kojto 122:f9eeca106725 3014 * function @ref LL_ADC_REG_SetTriggerEdge().
Kojto 122:f9eeca106725 3015 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3016 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3017 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3018 * ADC state:
Kojto 122:f9eeca106725 3019 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3020 * on group regular.
Kojto 122:f9eeca106725 3021 * @rmtoll CFGR EXTSEL LL_ADC_REG_SetTriggerSource\n
Kojto 122:f9eeca106725 3022 * CFGR EXTEN LL_ADC_REG_SetTriggerSource
Kojto 122:f9eeca106725 3023 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3024 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 3025 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3026 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3027 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3028 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
Kojto 122:f9eeca106725 3029 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
Kojto 122:f9eeca106725 3030 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
Kojto 122:f9eeca106725 3031 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3032 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
Kojto 122:f9eeca106725 3033 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3034 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3035 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3036 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
Kojto 122:f9eeca106725 3037 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3038 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3039 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3040 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3041 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
Kojto 122:f9eeca106725 3042 * @retval None
Kojto 122:f9eeca106725 3043 */
Kojto 122:f9eeca106725 3044 __STATIC_INLINE void LL_ADC_REG_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 3045 {
Kojto 122:f9eeca106725 3046 MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN | ADC_CFGR_EXTSEL, TriggerSource);
Kojto 122:f9eeca106725 3047 }
Kojto 122:f9eeca106725 3048
Kojto 122:f9eeca106725 3049 /**
Kojto 122:f9eeca106725 3050 * @brief Get ADC group regular conversion trigger source:
Kojto 122:f9eeca106725 3051 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3052 * external interrupt line).
Kojto 122:f9eeca106725 3053 * @note To determine whether group regular trigger source is
Kojto 122:f9eeca106725 3054 * internal (SW start) or external, without detail
Kojto 122:f9eeca106725 3055 * of which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3056 * (equivalent to
Kojto 122:f9eeca106725 3057 * "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)")
Kojto 122:f9eeca106725 3058 * use function @ref LL_ADC_REG_IsTriggerSourceSWStart.
Kojto 122:f9eeca106725 3059 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3060 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3061 * @rmtoll CFGR EXTSEL LL_ADC_REG_GetTriggerSource\n
Kojto 122:f9eeca106725 3062 * CFGR EXTEN LL_ADC_REG_GetTriggerSource
Kojto 122:f9eeca106725 3063 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3064 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3065 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3066 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3067 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3068 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
Kojto 122:f9eeca106725 3069 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
Kojto 122:f9eeca106725 3070 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
Kojto 122:f9eeca106725 3071 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3072 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
Kojto 122:f9eeca106725 3073 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3074 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3075 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3076 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
Kojto 122:f9eeca106725 3077 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3078 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3079 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3080 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3081 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
Kojto 122:f9eeca106725 3082 */
Kojto 122:f9eeca106725 3083 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3084 {
Kojto 122:f9eeca106725 3085 register uint32_t TriggerSource = READ_BIT(ADCx->CFGR, ADC_CFGR_EXTSEL | ADC_CFGR_EXTEN);
Kojto 122:f9eeca106725 3086
Kojto 122:f9eeca106725 3087 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
Kojto 122:f9eeca106725 3088 /* corresponding to ADC_CFGR_EXTEN {0; 1; 2; 3}. */
Kojto 122:f9eeca106725 3089 register uint32_t ShiftExten = ((TriggerSource & ADC_CFGR_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2U));
Kojto 122:f9eeca106725 3090
Kojto 122:f9eeca106725 3091 /* Set bitfield corresponding to ADC_CFGR_EXTEN and ADC_CFGR_EXTSEL */
Kojto 122:f9eeca106725 3092 /* to match with triggers literals definition. */
Kojto 122:f9eeca106725 3093 return ((TriggerSource
Kojto 122:f9eeca106725 3094 & (ADC_REG_TRIG_SOURCE_MASK >> ShiftExten) & ADC_CFGR_EXTSEL)
Kojto 122:f9eeca106725 3095 | ((ADC_REG_TRIG_EDGE_MASK >> ShiftExten) & ADC_CFGR_EXTEN)
Kojto 122:f9eeca106725 3096 );
Kojto 122:f9eeca106725 3097 }
Kojto 122:f9eeca106725 3098
Kojto 122:f9eeca106725 3099 /**
Kojto 122:f9eeca106725 3100 * @brief Get ADC group regular conversion trigger source internal (SW start)
Kojto 122:f9eeca106725 3101 or external.
Kojto 122:f9eeca106725 3102 * @note In case of group regular trigger source set to external trigger,
Kojto 122:f9eeca106725 3103 * to determine which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3104 * use function @ref LL_ADC_REG_GetTriggerSource().
Kojto 122:f9eeca106725 3105 * @rmtoll CFGR EXTEN LL_ADC_REG_IsTriggerSourceSWStart
Kojto 122:f9eeca106725 3106 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3107 * @retval Value "0" if trigger source external trigger
Kojto 122:f9eeca106725 3108 * Value "1" if trigger source SW start.
Kojto 122:f9eeca106725 3109 */
Kojto 122:f9eeca106725 3110 __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3111 {
Kojto 122:f9eeca106725 3112 return (READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN));
Kojto 122:f9eeca106725 3113 }
Kojto 122:f9eeca106725 3114
Kojto 122:f9eeca106725 3115 /**
Kojto 122:f9eeca106725 3116 * @brief Set ADC group regular conversion trigger polarity.
Kojto 122:f9eeca106725 3117 * @note Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3118 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3119 * ADC state:
Kojto 122:f9eeca106725 3120 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3121 * on group regular.
Kojto 122:f9eeca106725 3122 * @rmtoll CFGR EXTEN LL_ADC_REG_SetTriggerEdge
Kojto 122:f9eeca106725 3123 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3124 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 3125 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3126 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3127 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3128 * @retval None
Kojto 122:f9eeca106725 3129 */
Kojto 122:f9eeca106725 3130 __STATIC_INLINE void LL_ADC_REG_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
Kojto 122:f9eeca106725 3131 {
Kojto 122:f9eeca106725 3132 MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN, ExternalTriggerEdge);
Kojto 122:f9eeca106725 3133 }
Kojto 122:f9eeca106725 3134
Kojto 122:f9eeca106725 3135 /**
Kojto 122:f9eeca106725 3136 * @brief Get ADC group regular conversion trigger polarity.
Kojto 122:f9eeca106725 3137 * @note Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3138 * @rmtoll CFGR EXTEN LL_ADC_REG_GetTriggerEdge
Kojto 122:f9eeca106725 3139 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3140 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3141 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3142 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3143 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3144 */
Kojto 122:f9eeca106725 3145 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3146 {
Kojto 122:f9eeca106725 3147 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN));
Kojto 122:f9eeca106725 3148 }
Kojto 122:f9eeca106725 3149
Kojto 122:f9eeca106725 3150
Kojto 122:f9eeca106725 3151 /**
Kojto 122:f9eeca106725 3152 * @brief Set ADC group regular sequencer length and scan direction.
Kojto 122:f9eeca106725 3153 * @note Description of ADC group regular sequencer features:
Kojto 122:f9eeca106725 3154 * - For devices with sequencer fully configurable
Kojto 122:f9eeca106725 3155 * (function "LL_ADC_REG_SetSequencerRanks()" available):
Kojto 122:f9eeca106725 3156 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3157 * are configurable.
Kojto 122:f9eeca106725 3158 * This function performs configuration of:
Kojto 122:f9eeca106725 3159 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3160 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3161 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3162 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3163 * function "LL_ADC_REG_SetSequencerRanks()".
Kojto 122:f9eeca106725 3164 * - For devices with sequencer not fully configurable
Kojto 122:f9eeca106725 3165 * (function "LL_ADC_REG_SetSequencerChannels()" available):
Kojto 122:f9eeca106725 3166 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3167 * are defined by channel number.
Kojto 122:f9eeca106725 3168 * This function performs configuration of:
Kojto 122:f9eeca106725 3169 * - Sequence length: Number of ranks in the scan sequence is
Kojto 122:f9eeca106725 3170 * defined by number of channels set in the sequence,
Kojto 122:f9eeca106725 3171 * rank of each channel is fixed by channel HW number.
Kojto 122:f9eeca106725 3172 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
Kojto 122:f9eeca106725 3173 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3174 * scan direction is forward (from lowest channel number to
Kojto 122:f9eeca106725 3175 * highest channel number).
Kojto 122:f9eeca106725 3176 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3177 * function "LL_ADC_REG_SetSequencerChannels()".
Kojto 122:f9eeca106725 3178 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3179 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3180 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3181 * ADC state:
Kojto 122:f9eeca106725 3182 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3183 * on group regular.
Kojto 122:f9eeca106725 3184 * @rmtoll SQR1 L LL_ADC_REG_SetSequencerLength
Kojto 122:f9eeca106725 3185 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3186 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 3187 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3188 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3189 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3190 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3191 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
Kojto 122:f9eeca106725 3192 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
Kojto 122:f9eeca106725 3193 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
Kojto 122:f9eeca106725 3194 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
Kojto 122:f9eeca106725 3195 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
Kojto 122:f9eeca106725 3196 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
Kojto 122:f9eeca106725 3197 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
Kojto 122:f9eeca106725 3198 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
Kojto 122:f9eeca106725 3199 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
Kojto 122:f9eeca106725 3200 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
Kojto 122:f9eeca106725 3201 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
Kojto 122:f9eeca106725 3202 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
Kojto 122:f9eeca106725 3203 * @retval None
Kojto 122:f9eeca106725 3204 */
Kojto 122:f9eeca106725 3205 __STATIC_INLINE void LL_ADC_REG_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
Kojto 122:f9eeca106725 3206 {
Kojto 122:f9eeca106725 3207 MODIFY_REG(ADCx->SQR1, ADC_SQR1_L, SequencerNbRanks);
Kojto 122:f9eeca106725 3208 }
Kojto 122:f9eeca106725 3209
Kojto 122:f9eeca106725 3210 /**
Kojto 122:f9eeca106725 3211 * @brief Get ADC group regular sequencer length and scan direction.
Kojto 122:f9eeca106725 3212 * @note Description of ADC group regular sequencer features:
Kojto 122:f9eeca106725 3213 * - For devices with sequencer fully configurable
Kojto 122:f9eeca106725 3214 * (function "LL_ADC_REG_SetSequencerRanks()" available):
Kojto 122:f9eeca106725 3215 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3216 * are configurable.
Kojto 122:f9eeca106725 3217 * This function retrieves:
Kojto 122:f9eeca106725 3218 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3219 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3220 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3221 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3222 * function "LL_ADC_REG_SetSequencerRanks()".
Kojto 122:f9eeca106725 3223 * - For devices with sequencer not fully configurable
Kojto 122:f9eeca106725 3224 * (function "LL_ADC_REG_SetSequencerChannels()" available):
Kojto 122:f9eeca106725 3225 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3226 * are defined by channel number.
Kojto 122:f9eeca106725 3227 * This function retrieves:
Kojto 122:f9eeca106725 3228 * - Sequence length: Number of ranks in the scan sequence is
Kojto 122:f9eeca106725 3229 * defined by number of channels set in the sequence,
Kojto 122:f9eeca106725 3230 * rank of each channel is fixed by channel HW number.
Kojto 122:f9eeca106725 3231 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
Kojto 122:f9eeca106725 3232 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3233 * scan direction is forward (from lowest channel number to
Kojto 122:f9eeca106725 3234 * highest channel number).
Kojto 122:f9eeca106725 3235 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3236 * function "LL_ADC_REG_SetSequencerChannels()".
Kojto 122:f9eeca106725 3237 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3238 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3239 * @rmtoll SQR1 L LL_ADC_REG_GetSequencerLength
Kojto 122:f9eeca106725 3240 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3241 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3242 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3243 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3244 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3245 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3246 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
Kojto 122:f9eeca106725 3247 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
Kojto 122:f9eeca106725 3248 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
Kojto 122:f9eeca106725 3249 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
Kojto 122:f9eeca106725 3250 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
Kojto 122:f9eeca106725 3251 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
Kojto 122:f9eeca106725 3252 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
Kojto 122:f9eeca106725 3253 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
Kojto 122:f9eeca106725 3254 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
Kojto 122:f9eeca106725 3255 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
Kojto 122:f9eeca106725 3256 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
Kojto 122:f9eeca106725 3257 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
Kojto 122:f9eeca106725 3258 */
Kojto 122:f9eeca106725 3259 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3260 {
Kojto 122:f9eeca106725 3261 return (uint32_t)(READ_BIT(ADCx->SQR1, ADC_SQR1_L));
Kojto 122:f9eeca106725 3262 }
Kojto 122:f9eeca106725 3263
Kojto 122:f9eeca106725 3264 /**
Kojto 122:f9eeca106725 3265 * @brief Set ADC group regular sequencer discontinuous mode:
Kojto 122:f9eeca106725 3266 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3267 * number of ranks.
Kojto 122:f9eeca106725 3268 * @note It is not possible to enable both ADC group regular
Kojto 122:f9eeca106725 3269 * continuous mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3270 * @note It is not possible to enable both ADC auto-injected mode
Kojto 122:f9eeca106725 3271 * and ADC group regular sequencer discontinuous mode.
Kojto 122:f9eeca106725 3272 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3273 * ADC state:
Kojto 122:f9eeca106725 3274 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3275 * on group regular.
Kojto 122:f9eeca106725 3276 * @rmtoll CFGR DISCEN LL_ADC_REG_SetSequencerDiscont\n
Kojto 122:f9eeca106725 3277 * CFGR DISCNUM LL_ADC_REG_SetSequencerDiscont
Kojto 122:f9eeca106725 3278 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3279 * @param SeqDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 3280 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3281 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3282 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
Kojto 122:f9eeca106725 3283 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
Kojto 122:f9eeca106725 3284 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
Kojto 122:f9eeca106725 3285 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
Kojto 122:f9eeca106725 3286 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
Kojto 122:f9eeca106725 3287 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
Kojto 122:f9eeca106725 3288 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
Kojto 122:f9eeca106725 3289 * @retval None
Kojto 122:f9eeca106725 3290 */
Kojto 122:f9eeca106725 3291 __STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
Kojto 122:f9eeca106725 3292 {
Kojto 122:f9eeca106725 3293 MODIFY_REG(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM, SeqDiscont);
Kojto 122:f9eeca106725 3294 }
Kojto 122:f9eeca106725 3295
Kojto 122:f9eeca106725 3296 /**
Kojto 122:f9eeca106725 3297 * @brief Get ADC group regular sequencer discontinuous mode:
Kojto 122:f9eeca106725 3298 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3299 * number of ranks.
Kojto 122:f9eeca106725 3300 * @rmtoll CFGR DISCEN LL_ADC_REG_GetSequencerDiscont\n
Kojto 122:f9eeca106725 3301 * CFGR DISCNUM LL_ADC_REG_GetSequencerDiscont
Kojto 122:f9eeca106725 3302 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3303 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3304 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3305 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3306 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
Kojto 122:f9eeca106725 3307 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
Kojto 122:f9eeca106725 3308 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
Kojto 122:f9eeca106725 3309 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
Kojto 122:f9eeca106725 3310 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
Kojto 122:f9eeca106725 3311 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
Kojto 122:f9eeca106725 3312 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
Kojto 122:f9eeca106725 3313 */
Kojto 122:f9eeca106725 3314 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3315 {
Kojto 122:f9eeca106725 3316 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM));
Kojto 122:f9eeca106725 3317 }
Kojto 122:f9eeca106725 3318
Kojto 122:f9eeca106725 3319 /**
Kojto 122:f9eeca106725 3320 * @brief Set ADC group regular sequence: channel on the selected
Kojto 122:f9eeca106725 3321 * scan sequence rank.
Kojto 122:f9eeca106725 3322 * @note This function performs configuration of:
Kojto 122:f9eeca106725 3323 * - Channels ordering into each rank of scan sequence:
Kojto 122:f9eeca106725 3324 * whatever channel can be placed into whatever rank.
Kojto 122:f9eeca106725 3325 * @note On this STM32 serie, ADC group regular sequencer is
Kojto 122:f9eeca106725 3326 * fully configurable: sequencer length and each rank
Kojto 122:f9eeca106725 3327 * affectation to a channel are configurable.
Kojto 122:f9eeca106725 3328 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
Kojto 122:f9eeca106725 3329 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 3330 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 3331 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 3332 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 3333 * enabled separately.
Kojto 122:f9eeca106725 3334 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 3335 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3336 * ADC state:
Kojto 122:f9eeca106725 3337 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3338 * on group regular.
Kojto 122:f9eeca106725 3339 * @rmtoll SQR1 SQ1 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3340 * SQR1 SQ2 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3341 * SQR1 SQ3 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3342 * SQR1 SQ4 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3343 * SQR2 SQ5 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3344 * SQR2 SQ6 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3345 * SQR2 SQ7 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3346 * SQR2 SQ8 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3347 * SQR2 SQ9 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3348 * SQR3 SQ10 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3349 * SQR3 SQ11 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3350 * SQR3 SQ12 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3351 * SQR3 SQ13 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3352 * SQR3 SQ14 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3353 * SQR4 SQ15 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3354 * SQR4 SQ16 LL_ADC_REG_SetSequencerRanks
Kojto 122:f9eeca106725 3355 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3356 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 3357 * @arg @ref LL_ADC_REG_RANK_1
Kojto 122:f9eeca106725 3358 * @arg @ref LL_ADC_REG_RANK_2
Kojto 122:f9eeca106725 3359 * @arg @ref LL_ADC_REG_RANK_3
Kojto 122:f9eeca106725 3360 * @arg @ref LL_ADC_REG_RANK_4
Kojto 122:f9eeca106725 3361 * @arg @ref LL_ADC_REG_RANK_5
Kojto 122:f9eeca106725 3362 * @arg @ref LL_ADC_REG_RANK_6
Kojto 122:f9eeca106725 3363 * @arg @ref LL_ADC_REG_RANK_7
Kojto 122:f9eeca106725 3364 * @arg @ref LL_ADC_REG_RANK_8
Kojto 122:f9eeca106725 3365 * @arg @ref LL_ADC_REG_RANK_9
Kojto 122:f9eeca106725 3366 * @arg @ref LL_ADC_REG_RANK_10
Kojto 122:f9eeca106725 3367 * @arg @ref LL_ADC_REG_RANK_11
Kojto 122:f9eeca106725 3368 * @arg @ref LL_ADC_REG_RANK_12
Kojto 122:f9eeca106725 3369 * @arg @ref LL_ADC_REG_RANK_13
Kojto 122:f9eeca106725 3370 * @arg @ref LL_ADC_REG_RANK_14
Kojto 122:f9eeca106725 3371 * @arg @ref LL_ADC_REG_RANK_15
Kojto 122:f9eeca106725 3372 * @arg @ref LL_ADC_REG_RANK_16
Kojto 122:f9eeca106725 3373 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 3374 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 3375 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 3376 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 3377 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 3378 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 3379 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 3380 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 3381 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 3382 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 3383 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 3384 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 3385 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 3386 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 3387 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 3388 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 3389 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 3390 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 3391 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 3392 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 3393 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 3394 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 3395 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 3396 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 3397 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 3398 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 3399 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 3400 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 3401 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 3402 *
Kojto 122:f9eeca106725 3403 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 3404 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 3405 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 3406 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 3407 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 3408 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 3409 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 3410 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 3411 * @retval None
Kojto 122:f9eeca106725 3412 */
Kojto 122:f9eeca106725 3413 __STATIC_INLINE void LL_ADC_REG_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
Kojto 122:f9eeca106725 3414 {
Kojto 122:f9eeca106725 3415 /* Set bits with content of parameter "Channel" with bits position */
Kojto 122:f9eeca106725 3416 /* in register and register position depending on parameter "Rank". */
Kojto 122:f9eeca106725 3417 /* Parameters "Rank" and "Channel" are used with masks because containing */
Kojto 122:f9eeca106725 3418 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 3419 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 3420
Kojto 122:f9eeca106725 3421 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 3422 ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK),
Kojto 122:f9eeca106725 3423 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_REG_RANK_ID_SQRX_MASK)));
Kojto 122:f9eeca106725 3424 }
Kojto 122:f9eeca106725 3425
Kojto 122:f9eeca106725 3426 /**
Kojto 122:f9eeca106725 3427 * @brief Get ADC group regular sequence: channel on the selected
Kojto 122:f9eeca106725 3428 * scan sequence rank.
Kojto 122:f9eeca106725 3429 * @note On this STM32 serie, ADC group regular sequencer is
Kojto 122:f9eeca106725 3430 * fully configurable: sequencer length and each rank
Kojto 122:f9eeca106725 3431 * affectation to a channel are configurable.
Kojto 122:f9eeca106725 3432 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
Kojto 122:f9eeca106725 3433 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 3434 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 3435 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 3436 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 3437 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 3438 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 3439 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 3440 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 3441 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 3442 * as parameter for another function.
Kojto 122:f9eeca106725 3443 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 3444 * process the returned value with the helper macro
Kojto 122:f9eeca106725 3445 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 3446 * @rmtoll SQR1 SQ1 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3447 * SQR1 SQ2 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3448 * SQR1 SQ3 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3449 * SQR1 SQ4 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3450 * SQR2 SQ5 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3451 * SQR2 SQ6 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3452 * SQR2 SQ7 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3453 * SQR2 SQ8 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3454 * SQR2 SQ9 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3455 * SQR3 SQ10 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3456 * SQR3 SQ11 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3457 * SQR3 SQ12 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3458 * SQR3 SQ13 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3459 * SQR3 SQ14 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3460 * SQR4 SQ15 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3461 * SQR4 SQ16 LL_ADC_REG_GetSequencerRanks
Kojto 122:f9eeca106725 3462 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3463 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 3464 * @arg @ref LL_ADC_REG_RANK_1
Kojto 122:f9eeca106725 3465 * @arg @ref LL_ADC_REG_RANK_2
Kojto 122:f9eeca106725 3466 * @arg @ref LL_ADC_REG_RANK_3
Kojto 122:f9eeca106725 3467 * @arg @ref LL_ADC_REG_RANK_4
Kojto 122:f9eeca106725 3468 * @arg @ref LL_ADC_REG_RANK_5
Kojto 122:f9eeca106725 3469 * @arg @ref LL_ADC_REG_RANK_6
Kojto 122:f9eeca106725 3470 * @arg @ref LL_ADC_REG_RANK_7
Kojto 122:f9eeca106725 3471 * @arg @ref LL_ADC_REG_RANK_8
Kojto 122:f9eeca106725 3472 * @arg @ref LL_ADC_REG_RANK_9
Kojto 122:f9eeca106725 3473 * @arg @ref LL_ADC_REG_RANK_10
Kojto 122:f9eeca106725 3474 * @arg @ref LL_ADC_REG_RANK_11
Kojto 122:f9eeca106725 3475 * @arg @ref LL_ADC_REG_RANK_12
Kojto 122:f9eeca106725 3476 * @arg @ref LL_ADC_REG_RANK_13
Kojto 122:f9eeca106725 3477 * @arg @ref LL_ADC_REG_RANK_14
Kojto 122:f9eeca106725 3478 * @arg @ref LL_ADC_REG_RANK_15
Kojto 122:f9eeca106725 3479 * @arg @ref LL_ADC_REG_RANK_16
Kojto 122:f9eeca106725 3480 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3481 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 3482 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 3483 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 3484 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 3485 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 3486 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 3487 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 3488 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 3489 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 3490 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 3491 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 3492 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 3493 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 3494 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 3495 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 3496 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 3497 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 3498 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 3499 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 3500 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 3501 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 3502 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 3503 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 3504 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 3505 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 3506 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 3507 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 3508 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 3509 *
Kojto 122:f9eeca106725 3510 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 3511 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 3512 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 3513 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 3514 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 3515 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 3516 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 3517 * 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 3518 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 3519 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 3520 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 3521 */
Kojto 122:f9eeca106725 3522 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 3523 {
Kojto 122:f9eeca106725 3524 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 3525
Kojto 122:f9eeca106725 3526 return (uint32_t) (READ_BIT(*preg,
Kojto 122:f9eeca106725 3527 ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK))
Kojto 122:f9eeca106725 3528 << (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_REG_RANK_ID_SQRX_MASK))
Kojto 122:f9eeca106725 3529 );
Kojto 122:f9eeca106725 3530 }
Kojto 122:f9eeca106725 3531
Kojto 122:f9eeca106725 3532 /**
Kojto 122:f9eeca106725 3533 * @brief Set ADC continuous conversion mode on ADC group regular.
Kojto 122:f9eeca106725 3534 * @note Description of ADC continuous conversion mode:
Kojto 122:f9eeca106725 3535 * - single mode: one conversion per trigger
Kojto 122:f9eeca106725 3536 * - continuous mode: after the first trigger, following
Kojto 122:f9eeca106725 3537 * conversions launched successively automatically.
Kojto 122:f9eeca106725 3538 * @note It is not possible to enable both ADC group regular
Kojto 122:f9eeca106725 3539 * continuous mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3540 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3541 * ADC state:
Kojto 122:f9eeca106725 3542 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3543 * on group regular.
Kojto 122:f9eeca106725 3544 * @rmtoll CFGR CONT LL_ADC_REG_SetContinuousMode
Kojto 122:f9eeca106725 3545 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3546 * @param Continuous This parameter can be one of the following values:
Kojto 122:f9eeca106725 3547 * @arg @ref LL_ADC_REG_CONV_SINGLE
Kojto 122:f9eeca106725 3548 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
Kojto 122:f9eeca106725 3549 * @retval None
Kojto 122:f9eeca106725 3550 */
Kojto 122:f9eeca106725 3551 __STATIC_INLINE void LL_ADC_REG_SetContinuousMode(ADC_TypeDef *ADCx, uint32_t Continuous)
Kojto 122:f9eeca106725 3552 {
Kojto 122:f9eeca106725 3553 MODIFY_REG(ADCx->CFGR, ADC_CFGR_CONT, Continuous);
Kojto 122:f9eeca106725 3554 }
Kojto 122:f9eeca106725 3555
Kojto 122:f9eeca106725 3556 /**
Kojto 122:f9eeca106725 3557 * @brief Get ADC continuous conversion mode on ADC group regular.
Kojto 122:f9eeca106725 3558 * @note Description of ADC continuous conversion mode:
Kojto 122:f9eeca106725 3559 * - single mode: one conversion per trigger
Kojto 122:f9eeca106725 3560 * - continuous mode: after the first trigger, following
Kojto 122:f9eeca106725 3561 * conversions launched successively automatically.
Kojto 122:f9eeca106725 3562 * @rmtoll CFGR CONT LL_ADC_REG_GetContinuousMode
Kojto 122:f9eeca106725 3563 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3564 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3565 * @arg @ref LL_ADC_REG_CONV_SINGLE
Kojto 122:f9eeca106725 3566 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
Kojto 122:f9eeca106725 3567 */
Kojto 122:f9eeca106725 3568 __STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3569 {
Kojto 122:f9eeca106725 3570 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_CONT));
Kojto 122:f9eeca106725 3571 }
Kojto 122:f9eeca106725 3572
Kojto 122:f9eeca106725 3573 /**
Kojto 122:f9eeca106725 3574 * @brief Set ADC group regular conversion data transfer: no transfer or
Kojto 122:f9eeca106725 3575 * transfer by DMA, and DMA requests mode.
Kojto 122:f9eeca106725 3576 * @note If transfer by DMA selected, specifies the DMA requests
Kojto 122:f9eeca106725 3577 * mode:
Kojto 122:f9eeca106725 3578 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 3579 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 3580 * ADC conversions) is reached.
Kojto 122:f9eeca106725 3581 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 3582 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 3583 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 3584 * ADC conversions).
Kojto 122:f9eeca106725 3585 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 3586 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 3587 * mode non-circular:
Kojto 122:f9eeca106725 3588 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 3589 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 3590 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 3591 * @note For devices with several ADC instances: ADC multimode DMA
Kojto 122:f9eeca106725 3592 * settings are available using function @ref LL_ADC_SetMultiDMATransfer().
Kojto 122:f9eeca106725 3593 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 3594 * use function @ref LL_ADC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 3595 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3596 * ADC state:
Kojto 122:f9eeca106725 3597 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3598 * on either groups regular or injected.
Kojto 122:f9eeca106725 3599 * @rmtoll CFGR DMAEN LL_ADC_REG_SetDMATransfer\n
Kojto 122:f9eeca106725 3600 * CFGR DMACFG LL_ADC_REG_SetDMATransfer
Kojto 122:f9eeca106725 3601 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3602 * @param DMATransfer This parameter can be one of the following values:
Kojto 122:f9eeca106725 3603 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
Kojto 122:f9eeca106725 3604 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
Kojto 122:f9eeca106725 3605 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
Kojto 122:f9eeca106725 3606 * @retval None
Kojto 122:f9eeca106725 3607 */
Kojto 122:f9eeca106725 3608 __STATIC_INLINE void LL_ADC_REG_SetDMATransfer(ADC_TypeDef *ADCx, uint32_t DMATransfer)
Kojto 122:f9eeca106725 3609 {
Kojto 122:f9eeca106725 3610 MODIFY_REG(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG, DMATransfer);
Kojto 122:f9eeca106725 3611 }
Kojto 122:f9eeca106725 3612
Kojto 122:f9eeca106725 3613 /**
Kojto 122:f9eeca106725 3614 * @brief Get ADC group regular conversion data transfer: no transfer or
Kojto 122:f9eeca106725 3615 * transfer by DMA, and DMA requests mode.
Kojto 122:f9eeca106725 3616 * @note If transfer by DMA selected, specifies the DMA requests
Kojto 122:f9eeca106725 3617 * mode:
Kojto 122:f9eeca106725 3618 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 3619 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 3620 * ADC conversions) is reached.
Kojto 122:f9eeca106725 3621 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 3622 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 3623 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 3624 * ADC conversions).
Kojto 122:f9eeca106725 3625 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 3626 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 3627 * mode non-circular:
Kojto 122:f9eeca106725 3628 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 3629 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 3630 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 3631 * @note For devices with several ADC instances: ADC multimode DMA
Kojto 122:f9eeca106725 3632 * settings are available using function @ref LL_ADC_GetMultiDMATransfer().
Kojto 122:f9eeca106725 3633 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 3634 * use function @ref LL_ADC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 3635 * @rmtoll CFGR DMAEN LL_ADC_REG_GetDMATransfer\n
Kojto 122:f9eeca106725 3636 * CFGR DMACFG LL_ADC_REG_GetDMATransfer
Kojto 122:f9eeca106725 3637 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3638 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3639 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
Kojto 122:f9eeca106725 3640 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
Kojto 122:f9eeca106725 3641 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
Kojto 122:f9eeca106725 3642 */
Kojto 122:f9eeca106725 3643 __STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3644 {
Kojto 122:f9eeca106725 3645 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG));
Kojto 122:f9eeca106725 3646 }
Kojto 122:f9eeca106725 3647
Kojto 122:f9eeca106725 3648
Kojto 122:f9eeca106725 3649 /**
Kojto 122:f9eeca106725 3650 * @brief Set ADC group regular behavior in case of overrun:
Kojto 122:f9eeca106725 3651 * data preserved or overwritten.
Kojto 122:f9eeca106725 3652 * @note Compatibility with devices without feature overrun:
Kojto 122:f9eeca106725 3653 * other devices without this feature have a behavior
Kojto 122:f9eeca106725 3654 * equivalent to data overwritten.
Kojto 122:f9eeca106725 3655 * The default setting of overrun is data preserved.
Kojto 122:f9eeca106725 3656 * Therefore, for compatibility with all devices, parameter
Kojto 122:f9eeca106725 3657 * overrun should be set to data overwritten.
Kojto 122:f9eeca106725 3658 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3659 * ADC state:
Kojto 122:f9eeca106725 3660 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3661 * on group regular.
Kojto 122:f9eeca106725 3662 * @rmtoll CFGR OVRMOD LL_ADC_REG_SetOverrun
Kojto 122:f9eeca106725 3663 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3664 * @param Overrun This parameter can be one of the following values:
Kojto 122:f9eeca106725 3665 * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
Kojto 122:f9eeca106725 3666 * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
Kojto 122:f9eeca106725 3667 * @retval None
Kojto 122:f9eeca106725 3668 */
Kojto 122:f9eeca106725 3669 __STATIC_INLINE void LL_ADC_REG_SetOverrun(ADC_TypeDef *ADCx, uint32_t Overrun)
Kojto 122:f9eeca106725 3670 {
Kojto 122:f9eeca106725 3671 MODIFY_REG(ADCx->CFGR, ADC_CFGR_OVRMOD, Overrun);
Kojto 122:f9eeca106725 3672 }
Kojto 122:f9eeca106725 3673
Kojto 122:f9eeca106725 3674 /**
Kojto 122:f9eeca106725 3675 * @brief Get ADC group regular behavior in case of overrun:
Kojto 122:f9eeca106725 3676 * data preserved or overwritten.
Kojto 122:f9eeca106725 3677 * @rmtoll CFGR OVRMOD LL_ADC_REG_GetOverrun
Kojto 122:f9eeca106725 3678 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3679 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3680 * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
Kojto 122:f9eeca106725 3681 * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
Kojto 122:f9eeca106725 3682 */
Kojto 122:f9eeca106725 3683 __STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3684 {
Kojto 122:f9eeca106725 3685 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_OVRMOD));
Kojto 122:f9eeca106725 3686 }
Kojto 122:f9eeca106725 3687
Kojto 122:f9eeca106725 3688 /**
Kojto 122:f9eeca106725 3689 * @}
Kojto 122:f9eeca106725 3690 */
Kojto 122:f9eeca106725 3691
Kojto 122:f9eeca106725 3692 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Injected Configuration of ADC hierarchical scope: group injected
Kojto 122:f9eeca106725 3693 * @{
Kojto 122:f9eeca106725 3694 */
Kojto 122:f9eeca106725 3695
Kojto 122:f9eeca106725 3696 /**
Kojto 122:f9eeca106725 3697 * @brief Set ADC group injected conversion trigger source:
Kojto 122:f9eeca106725 3698 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3699 * external interrupt line).
Kojto 122:f9eeca106725 3700 * @note On this STM32 serie, setting trigger source to external trigger
Kojto 122:f9eeca106725 3701 * also set trigger polarity to rising edge
Kojto 122:f9eeca106725 3702 * (default setting for compatibility with some ADC on other
Kojto 122:f9eeca106725 3703 * STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 3704 * In case of need to modify trigger edge, use
Kojto 122:f9eeca106725 3705 * function @ref LL_ADC_INJ_SetTriggerEdge().
Kojto 122:f9eeca106725 3706 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3707 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3708 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3709 * ADC state:
Kojto 122:f9eeca106725 3710 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3711 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3712 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_SetTriggerSource\n
Kojto 122:f9eeca106725 3713 * JSQR JEXTEN LL_ADC_INJ_SetTriggerSource
Kojto 122:f9eeca106725 3714 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3715 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 3716 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3717 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3718 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3719 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 3720 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3721 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 3722 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3723 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 3724 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 3725 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3726 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3727 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3728 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 3729 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3730 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3731 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3732 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 3733 * @retval None
Kojto 122:f9eeca106725 3734 */
Kojto 122:f9eeca106725 3735 __STATIC_INLINE void LL_ADC_INJ_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 3736 {
Kojto 122:f9eeca106725 3737 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN, TriggerSource);
Kojto 122:f9eeca106725 3738 }
Kojto 122:f9eeca106725 3739
Kojto 122:f9eeca106725 3740 /**
Kojto 122:f9eeca106725 3741 * @brief Get ADC group injected conversion trigger source:
Kojto 122:f9eeca106725 3742 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3743 * external interrupt line).
Kojto 122:f9eeca106725 3744 * @note To determine whether group injected trigger source is
Kojto 122:f9eeca106725 3745 * internal (SW start) or external, without detail
Kojto 122:f9eeca106725 3746 * of which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3747 * (equivalent to
Kojto 122:f9eeca106725 3748 * "if(LL_ADC_INJ_GetTriggerSource(ADC1) == LL_ADC_INJ_TRIG_SOFTWARE)")
Kojto 122:f9eeca106725 3749 * use function @ref LL_ADC_INJ_IsTriggerSourceSWStart.
Kojto 122:f9eeca106725 3750 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3751 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3752 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_GetTriggerSource\n
Kojto 122:f9eeca106725 3753 * JSQR JEXTEN LL_ADC_INJ_GetTriggerSource
Kojto 122:f9eeca106725 3754 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3755 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3756 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3757 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3758 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3759 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 3760 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3761 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 3762 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3763 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 3764 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 3765 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3766 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3767 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3768 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 3769 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3770 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3771 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3772 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 3773 */
Kojto 122:f9eeca106725 3774 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerSource(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3775 {
Kojto 122:f9eeca106725 3776 register uint32_t TriggerSource = READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN);
Kojto 122:f9eeca106725 3777
Kojto 122:f9eeca106725 3778 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
Kojto 122:f9eeca106725 3779 /* corresponding to ADC_JSQR_JEXTEN {0; 1; 2; 3}. */
Kojto 122:f9eeca106725 3780 register uint32_t ShiftJexten = ((TriggerSource & ADC_JSQR_JEXTEN) >> (ADC_INJ_TRIG_EXTEN_BITOFFSET_POS - 2U));
Kojto 122:f9eeca106725 3781
Kojto 122:f9eeca106725 3782 /* Set bitfield corresponding to ADC_JSQR_JEXTEN and ADC_JSQR_JEXTSEL */
Kojto 122:f9eeca106725 3783 /* to match with triggers literals definition. */
Kojto 122:f9eeca106725 3784 return ((TriggerSource
Kojto 122:f9eeca106725 3785 & (ADC_INJ_TRIG_SOURCE_MASK >> ShiftJexten) & ADC_JSQR_JEXTSEL)
Kojto 122:f9eeca106725 3786 | ((ADC_INJ_TRIG_EDGE_MASK >> ShiftJexten) & ADC_JSQR_JEXTEN)
Kojto 122:f9eeca106725 3787 );
Kojto 122:f9eeca106725 3788 }
Kojto 122:f9eeca106725 3789
Kojto 122:f9eeca106725 3790 /**
Kojto 122:f9eeca106725 3791 * @brief Get ADC group injected conversion trigger source internal (SW start)
Kojto 122:f9eeca106725 3792 or external
Kojto 122:f9eeca106725 3793 * @note In case of group injected trigger source set to external trigger,
Kojto 122:f9eeca106725 3794 * to determine which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3795 * use function @ref LL_ADC_INJ_GetTriggerSource.
Kojto 122:f9eeca106725 3796 * @rmtoll JSQR JEXTEN LL_ADC_INJ_IsTriggerSourceSWStart
Kojto 122:f9eeca106725 3797 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3798 * @retval Value "0" if trigger source external trigger
Kojto 122:f9eeca106725 3799 * Value "1" if trigger source SW start.
Kojto 122:f9eeca106725 3800 */
Kojto 122:f9eeca106725 3801 __STATIC_INLINE uint32_t LL_ADC_INJ_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3802 {
Kojto 122:f9eeca106725 3803 return (READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN) == (LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTEN));
Kojto 122:f9eeca106725 3804 }
Kojto 122:f9eeca106725 3805
Kojto 122:f9eeca106725 3806 /**
Kojto 122:f9eeca106725 3807 * @brief Set ADC group injected conversion trigger polarity.
Kojto 122:f9eeca106725 3808 * Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3809 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3810 * ADC state:
Kojto 122:f9eeca106725 3811 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3812 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3813 * @rmtoll JSQR JEXTEN LL_ADC_INJ_SetTriggerEdge
Kojto 122:f9eeca106725 3814 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3815 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 3816 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3817 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3818 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3819 * @retval None
Kojto 122:f9eeca106725 3820 */
Kojto 122:f9eeca106725 3821 __STATIC_INLINE void LL_ADC_INJ_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
Kojto 122:f9eeca106725 3822 {
Kojto 122:f9eeca106725 3823 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTEN, ExternalTriggerEdge);
Kojto 122:f9eeca106725 3824 }
Kojto 122:f9eeca106725 3825
Kojto 122:f9eeca106725 3826 /**
Kojto 122:f9eeca106725 3827 * @brief Get ADC group injected conversion trigger polarity.
Kojto 122:f9eeca106725 3828 * Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3829 * @rmtoll JSQR JEXTEN LL_ADC_INJ_GetTriggerEdge
Kojto 122:f9eeca106725 3830 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3831 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3832 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3833 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3834 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3835 */
Kojto 122:f9eeca106725 3836 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerEdge(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3837 {
Kojto 122:f9eeca106725 3838 return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN));
Kojto 122:f9eeca106725 3839 }
Kojto 122:f9eeca106725 3840
Kojto 122:f9eeca106725 3841 /**
Kojto 122:f9eeca106725 3842 * @brief Set ADC group injected sequencer length and scan direction.
Kojto 122:f9eeca106725 3843 * @note This function performs configuration of:
Kojto 122:f9eeca106725 3844 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3845 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3846 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3847 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3848 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3849 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3850 * ADC state:
Kojto 122:f9eeca106725 3851 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3852 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3853 * @rmtoll JSQR JL LL_ADC_INJ_SetSequencerLength
Kojto 122:f9eeca106725 3854 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3855 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 3856 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3857 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3858 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3859 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3860 * @retval None
Kojto 122:f9eeca106725 3861 */
Kojto 122:f9eeca106725 3862 __STATIC_INLINE void LL_ADC_INJ_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
Kojto 122:f9eeca106725 3863 {
Kojto 122:f9eeca106725 3864 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JL, SequencerNbRanks);
Kojto 122:f9eeca106725 3865 }
Kojto 122:f9eeca106725 3866
Kojto 122:f9eeca106725 3867 /**
Kojto 122:f9eeca106725 3868 * @brief Get ADC group injected sequencer length and scan direction.
Kojto 122:f9eeca106725 3869 * @note This function retrieves:
Kojto 122:f9eeca106725 3870 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3871 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3872 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3873 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3874 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3875 * @rmtoll JSQR JL LL_ADC_INJ_GetSequencerLength
Kojto 122:f9eeca106725 3876 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3877 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3878 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3879 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3880 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3881 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3882 */
Kojto 122:f9eeca106725 3883 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerLength(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3884 {
Kojto 122:f9eeca106725 3885 return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JL));
Kojto 122:f9eeca106725 3886 }
Kojto 122:f9eeca106725 3887
Kojto 122:f9eeca106725 3888 /**
Kojto 122:f9eeca106725 3889 * @brief Set ADC group injected sequencer discontinuous mode:
Kojto 122:f9eeca106725 3890 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3891 * number of ranks.
Kojto 122:f9eeca106725 3892 * @note It is not possible to enable both ADC group injected
Kojto 122:f9eeca106725 3893 * auto-injected mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3894 * @rmtoll CFGR JDISCEN LL_ADC_INJ_SetSequencerDiscont
Kojto 122:f9eeca106725 3895 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3896 * @param SeqDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 3897 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3898 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3899 * @retval None
Kojto 122:f9eeca106725 3900 */
Kojto 122:f9eeca106725 3901 __STATIC_INLINE void LL_ADC_INJ_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
Kojto 122:f9eeca106725 3902 {
Kojto 122:f9eeca106725 3903 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JDISCEN, SeqDiscont);
Kojto 122:f9eeca106725 3904 }
Kojto 122:f9eeca106725 3905
Kojto 122:f9eeca106725 3906 /**
Kojto 122:f9eeca106725 3907 * @brief Get ADC group injected sequencer discontinuous mode:
Kojto 122:f9eeca106725 3908 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3909 * number of ranks.
Kojto 122:f9eeca106725 3910 * @rmtoll CFGR JDISCEN LL_ADC_INJ_GetSequencerDiscont
Kojto 122:f9eeca106725 3911 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3912 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3913 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3914 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3915 */
Kojto 122:f9eeca106725 3916 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3917 {
Kojto 122:f9eeca106725 3918 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JDISCEN));
Kojto 122:f9eeca106725 3919 }
Kojto 122:f9eeca106725 3920
Kojto 122:f9eeca106725 3921 /**
Kojto 122:f9eeca106725 3922 * @brief Set ADC group injected sequence: channel on the selected
Kojto 122:f9eeca106725 3923 * sequence rank.
Kojto 122:f9eeca106725 3924 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 3925 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 3926 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 3927 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 3928 * enabled separately.
Kojto 122:f9eeca106725 3929 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 3930 * @note On this STM32 serie, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 3931 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 3932 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3933 * ADC state:
Kojto 122:f9eeca106725 3934 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3935 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3936 * @rmtoll JSQR JSQ1 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 3937 * JSQR JSQ2 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 3938 * JSQR JSQ3 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 3939 * JSQR JSQ4 LL_ADC_INJ_SetSequencerRanks
Kojto 122:f9eeca106725 3940 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3941 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 3942 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 3943 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 3944 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 3945 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 3946 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 3947 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 3948 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 3949 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 3950 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 3951 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 3952 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 3953 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 3954 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 3955 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 3956 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 3957 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 3958 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 3959 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 3960 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 3961 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 3962 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 3963 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 3964 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 3965 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 3966 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 3967 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 3968 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 3969 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 3970 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 3971 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 3972 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 3973 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 3974 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 3975 *
Kojto 122:f9eeca106725 3976 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 3977 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 3978 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 3979 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 3980 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 3981 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 3982 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 3983 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 3984 * @retval None
Kojto 122:f9eeca106725 3985 */
Kojto 122:f9eeca106725 3986 __STATIC_INLINE void LL_ADC_INJ_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
Kojto 122:f9eeca106725 3987 {
Kojto 122:f9eeca106725 3988 /* Set bits with content of parameter "Channel" with bits position */
Kojto 122:f9eeca106725 3989 /* in register depending on parameter "Rank". */
Kojto 122:f9eeca106725 3990 /* Parameters "Rank" and "Channel" are used with masks because containing */
Kojto 122:f9eeca106725 3991 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 3992 MODIFY_REG(ADCx->JSQR,
Kojto 122:f9eeca106725 3993 ADC_CHANNEL_ID_NUMBER_MASK >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)),
Kojto 122:f9eeca106725 3994 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)));
Kojto 122:f9eeca106725 3995 }
Kojto 122:f9eeca106725 3996
Kojto 122:f9eeca106725 3997 /**
Kojto 122:f9eeca106725 3998 * @brief Get ADC group injected sequence: channel on the selected
Kojto 122:f9eeca106725 3999 * sequence rank.
Kojto 122:f9eeca106725 4000 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 4001 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 4002 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 4003 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 4004 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 4005 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 4006 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 4007 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4008 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 4009 * as parameter for another function.
Kojto 122:f9eeca106725 4010 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 4011 * process the returned value with the helper macro
Kojto 122:f9eeca106725 4012 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4013 * @rmtoll JSQR JSQ1 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4014 * JSQR JSQ2 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4015 * JSQR JSQ3 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4016 * JSQR JSQ4 LL_ADC_INJ_GetSequencerRanks
Kojto 122:f9eeca106725 4017 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4018 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 4019 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 4020 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 4021 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 4022 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 4023 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4024 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4025 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4026 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4027 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4028 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4029 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4030 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4031 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4032 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4033 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4034 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4035 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4036 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4037 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4038 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4039 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4040 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4041 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4042 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4043 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4044 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4045 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4046 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4047 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4048 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4049 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4050 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4051 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4052 *
Kojto 122:f9eeca106725 4053 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4054 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4055 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4056 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4057 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4058 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4059 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4060 * 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 4061 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 4062 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 4063 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 4064 */
Kojto 122:f9eeca106725 4065 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 4066 {
Kojto 122:f9eeca106725 4067 return (uint32_t)(READ_BIT(ADCx->JSQR,
Kojto 122:f9eeca106725 4068 ADC_CHANNEL_ID_NUMBER_MASK >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)))
Kojto 122:f9eeca106725 4069 << (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK))
Kojto 122:f9eeca106725 4070 );
Kojto 122:f9eeca106725 4071 }
Kojto 122:f9eeca106725 4072
Kojto 122:f9eeca106725 4073 /**
Kojto 122:f9eeca106725 4074 * @brief Set ADC group injected conversion trigger:
Kojto 122:f9eeca106725 4075 * independent or from ADC group regular.
Kojto 122:f9eeca106725 4076 * @note This mode can be used to extend number of data registers
Kojto 122:f9eeca106725 4077 * updated after one ADC conversion trigger and with data
Kojto 122:f9eeca106725 4078 * permanently kept (not erased by successive conversions of scan of
Kojto 122:f9eeca106725 4079 * ADC sequencer ranks), up to 5 data registers:
Kojto 122:f9eeca106725 4080 * 1 data register on ADC group regular, 4 data registers
Kojto 122:f9eeca106725 4081 * on ADC group injected.
Kojto 122:f9eeca106725 4082 * @note If ADC group injected injected trigger source is set to an
Kojto 122:f9eeca106725 4083 * external trigger, this feature must be must be set to
Kojto 122:f9eeca106725 4084 * independent trigger.
Kojto 122:f9eeca106725 4085 * ADC group injected automatic trigger is compliant only with
Kojto 122:f9eeca106725 4086 * group injected trigger source set to SW start, without any
Kojto 122:f9eeca106725 4087 * further action on ADC group injected conversion start or stop:
Kojto 122:f9eeca106725 4088 * in this case, ADC group injected is controlled only
Kojto 122:f9eeca106725 4089 * from ADC group regular.
Kojto 122:f9eeca106725 4090 * @note It is not possible to enable both ADC group injected
Kojto 122:f9eeca106725 4091 * auto-injected mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 4092 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4093 * ADC state:
Kojto 122:f9eeca106725 4094 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4095 * on either groups regular or injected.
Kojto 122:f9eeca106725 4096 * @rmtoll CFGR JAUTO LL_ADC_INJ_SetTrigAuto
Kojto 122:f9eeca106725 4097 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4098 * @param TrigAuto This parameter can be one of the following values:
Kojto 122:f9eeca106725 4099 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
Kojto 122:f9eeca106725 4100 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
Kojto 122:f9eeca106725 4101 * @retval None
Kojto 122:f9eeca106725 4102 */
Kojto 122:f9eeca106725 4103 __STATIC_INLINE void LL_ADC_INJ_SetTrigAuto(ADC_TypeDef *ADCx, uint32_t TrigAuto)
Kojto 122:f9eeca106725 4104 {
Kojto 122:f9eeca106725 4105 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JAUTO, TrigAuto);
Kojto 122:f9eeca106725 4106 }
Kojto 122:f9eeca106725 4107
Kojto 122:f9eeca106725 4108 /**
Kojto 122:f9eeca106725 4109 * @brief Get ADC group injected conversion trigger:
Kojto 122:f9eeca106725 4110 * independent or from ADC group regular.
Kojto 122:f9eeca106725 4111 * @rmtoll CFGR JAUTO LL_ADC_INJ_GetTrigAuto
Kojto 122:f9eeca106725 4112 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4113 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4114 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
Kojto 122:f9eeca106725 4115 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
Kojto 122:f9eeca106725 4116 */
Kojto 122:f9eeca106725 4117 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTrigAuto(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 4118 {
Kojto 122:f9eeca106725 4119 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JAUTO));
Kojto 122:f9eeca106725 4120 }
Kojto 122:f9eeca106725 4121
Kojto 122:f9eeca106725 4122 /**
Kojto 122:f9eeca106725 4123 * @brief Set ADC group injected contexts queue mode.
Kojto 122:f9eeca106725 4124 * @note A context is a setting of group injected sequencer:
Kojto 122:f9eeca106725 4125 * - group injected trigger
Kojto 122:f9eeca106725 4126 * - sequencer length
Kojto 122:f9eeca106725 4127 * - sequencer ranks
Kojto 122:f9eeca106725 4128 * If contexts queue is disabled:
Kojto 122:f9eeca106725 4129 * - only 1 sequence can be configured
Kojto 122:f9eeca106725 4130 * and is active perpetually.
Kojto 122:f9eeca106725 4131 * If contexts queue is enabled:
Kojto 122:f9eeca106725 4132 * - up to 2 contexts can be queued
Kojto 122:f9eeca106725 4133 * and are checked in and out as a FIFO stack (first-in, first-out).
Kojto 122:f9eeca106725 4134 * - If a new context is set when queues is full, error is triggered
Kojto 122:f9eeca106725 4135 * by interruption "Injected Queue Overflow".
Kojto 122:f9eeca106725 4136 * - Two behaviors are possible when all contexts have been processed:
Kojto 122:f9eeca106725 4137 * the contexts queue can maintain the last context active perpetually
Kojto 122:f9eeca106725 4138 * or can be empty and injected group triggers are disabled.
Kojto 122:f9eeca106725 4139 * - Triggers can be only external (not internal SW start)
Kojto 122:f9eeca106725 4140 * - Caution: The sequence must be fully configured in one time
Kojto 122:f9eeca106725 4141 * (one write of register JSQR makes a check-in of a new context
Kojto 122:f9eeca106725 4142 * into the queue).
Kojto 122:f9eeca106725 4143 * Therefore functions to set separately injected trigger and
Kojto 122:f9eeca106725 4144 * sequencer channels cannot be used, register JSQR must be set
Kojto 122:f9eeca106725 4145 * using function @ref LL_ADC_INJ_ConfigQueueContext().
Kojto 122:f9eeca106725 4146 * @note This parameter can be modified only when no conversion is on going
Kojto 122:f9eeca106725 4147 * on either groups regular or injected.
Kojto 122:f9eeca106725 4148 * @note A modification of the context mode (bit JQDIS) causes the contexts
Kojto 122:f9eeca106725 4149 * queue to be flushed and the register JSQR is cleared.
Kojto 122:f9eeca106725 4150 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4151 * ADC state:
Kojto 122:f9eeca106725 4152 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4153 * on either groups regular or injected.
Kojto 122:f9eeca106725 4154 * @rmtoll CFGR JQM LL_ADC_INJ_SetQueueMode\n
Kojto 122:f9eeca106725 4155 * CFGR JQDIS LL_ADC_INJ_SetQueueMode
Kojto 122:f9eeca106725 4156 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4157 * @param QueueMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 4158 * @arg @ref LL_ADC_INJ_QUEUE_DISABLE
Kojto 122:f9eeca106725 4159 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
Kojto 122:f9eeca106725 4160 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
Kojto 122:f9eeca106725 4161 * @retval None
Kojto 122:f9eeca106725 4162 */
Kojto 122:f9eeca106725 4163 __STATIC_INLINE void LL_ADC_INJ_SetQueueMode(ADC_TypeDef *ADCx, uint32_t QueueMode)
Kojto 122:f9eeca106725 4164 {
Kojto 122:f9eeca106725 4165 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS, QueueMode);
Kojto 122:f9eeca106725 4166 }
Kojto 122:f9eeca106725 4167
Kojto 122:f9eeca106725 4168 /**
Kojto 122:f9eeca106725 4169 * @brief Get ADC group injected context queue mode.
Kojto 122:f9eeca106725 4170 * @rmtoll CFGR JQM LL_ADC_INJ_GetQueueMode\n
Kojto 122:f9eeca106725 4171 * CFGR JQDIS LL_ADC_INJ_GetQueueMode
Kojto 122:f9eeca106725 4172 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4173 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4174 * @arg @ref LL_ADC_INJ_QUEUE_DISABLE
Kojto 122:f9eeca106725 4175 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
Kojto 122:f9eeca106725 4176 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
Kojto 122:f9eeca106725 4177 */
Kojto 122:f9eeca106725 4178 __STATIC_INLINE uint32_t LL_ADC_INJ_GetQueueMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 4179 {
Kojto 122:f9eeca106725 4180 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS));
Kojto 122:f9eeca106725 4181 }
Kojto 122:f9eeca106725 4182
Kojto 122:f9eeca106725 4183 /**
Kojto 122:f9eeca106725 4184 * @brief Set one context on ADC group injected that will be checked in
Kojto 122:f9eeca106725 4185 * contexts queue.
Kojto 122:f9eeca106725 4186 * @note A context is a setting of group injected sequencer:
Kojto 122:f9eeca106725 4187 * - group injected trigger
Kojto 122:f9eeca106725 4188 * - sequencer length
Kojto 122:f9eeca106725 4189 * - sequencer ranks
Kojto 122:f9eeca106725 4190 * This function is intended to be used when contexts queue is enabled,
Kojto 122:f9eeca106725 4191 * because the sequence must be fully configured in one time
Kojto 122:f9eeca106725 4192 * (functions to set separately injected trigger and sequencer channels
Kojto 122:f9eeca106725 4193 * cannot be used):
Kojto 122:f9eeca106725 4194 * Refer to function @ref LL_ADC_INJ_SetQueueMode().
Kojto 122:f9eeca106725 4195 * @note In the contexts queue, only the active context can be read.
Kojto 122:f9eeca106725 4196 * The parameters of this function can be read using functions:
Kojto 122:f9eeca106725 4197 * @arg @ref LL_ADC_INJ_GetTriggerSource()
Kojto 122:f9eeca106725 4198 * @arg @ref LL_ADC_INJ_GetTriggerEdge()
Kojto 122:f9eeca106725 4199 * @arg @ref LL_ADC_INJ_GetSequencerRanks()
Kojto 122:f9eeca106725 4200 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 4201 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 4202 * enabled separately.
Kojto 122:f9eeca106725 4203 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 4204 * @note On this STM32 serie, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 4205 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 4206 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4207 * ADC state:
Kojto 122:f9eeca106725 4208 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 4209 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 4210 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4211 * JSQR JEXTEN LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4212 * JSQR JL LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4213 * JSQR JSQ1 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4214 * JSQR JSQ2 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4215 * JSQR JSQ3 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4216 * JSQR JSQ4 LL_ADC_INJ_ConfigQueueContext
Kojto 122:f9eeca106725 4217 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4218 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 4219 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 4220 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 4221 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 4222 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 4223 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 4224 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 4225 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 4226 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 4227 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 4228 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 4229 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 4230 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 4231 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 4232 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 4233 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 4234 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 4235 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 4236 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 4237 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 4238 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 4239 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 4240 *
Kojto 122:f9eeca106725 4241 * Note: This parameter is discarded in case of SW start:
Kojto 122:f9eeca106725 4242 * parameter "TriggerSource" set to "LL_ADC_INJ_TRIG_SOFTWARE".
Kojto 122:f9eeca106725 4243 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 4244 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 4245 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 4246 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 4247 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 4248 * @param Rank1_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4249 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4250 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4251 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4252 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4253 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4254 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4255 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4256 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4257 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4258 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4259 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4260 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4261 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4262 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4263 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4264 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4265 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4266 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4267 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4268 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4269 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4270 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4271 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4272 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4273 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4274 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4275 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4276 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4277 *
Kojto 122:f9eeca106725 4278 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4279 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4280 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4281 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4282 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4283 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4284 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4285 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4286 * @param Rank2_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4287 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4288 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4289 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4290 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4291 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4292 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4293 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4294 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4295 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4296 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4297 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4298 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4299 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4300 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4301 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4302 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4303 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4304 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4305 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4306 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4307 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4308 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4309 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4310 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4311 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4312 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4313 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4314 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4315 *
Kojto 122:f9eeca106725 4316 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4317 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4318 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4319 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4320 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4321 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4322 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4323 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4324 * @param Rank3_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4325 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4326 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4327 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4328 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4329 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4330 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4331 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4332 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4333 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4334 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4335 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4336 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4337 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4338 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4339 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4340 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4341 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4342 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4343 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4344 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4345 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4346 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4347 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4348 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4349 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4350 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4351 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4352 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4353 *
Kojto 122:f9eeca106725 4354 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4355 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4356 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4357 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4358 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4359 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4360 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4361 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4362 * @param Rank4_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4363 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4364 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4365 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4366 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4367 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4368 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4369 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4370 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4371 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4372 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4373 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4374 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4375 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4376 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4377 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4378 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4379 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4380 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4381 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4382 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4383 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4384 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4385 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4386 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4387 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4388 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4389 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4390 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4391 *
Kojto 122:f9eeca106725 4392 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4393 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4394 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4395 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4396 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4397 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4398 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4399 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4400 * @retval None
Kojto 122:f9eeca106725 4401 */
Kojto 122:f9eeca106725 4402 __STATIC_INLINE void LL_ADC_INJ_ConfigQueueContext(ADC_TypeDef *ADCx,
Kojto 122:f9eeca106725 4403 uint32_t TriggerSource,
Kojto 122:f9eeca106725 4404 uint32_t ExternalTriggerEdge,
Kojto 122:f9eeca106725 4405 uint32_t SequencerNbRanks,
Kojto 122:f9eeca106725 4406 uint32_t Rank1_Channel,
Kojto 122:f9eeca106725 4407 uint32_t Rank2_Channel,
Kojto 122:f9eeca106725 4408 uint32_t Rank3_Channel,
Kojto 122:f9eeca106725 4409 uint32_t Rank4_Channel)
Kojto 122:f9eeca106725 4410 {
Kojto 122:f9eeca106725 4411 /* Set bits with content of parameter "Rankx_Channel" with bits position */
Kojto 122:f9eeca106725 4412 /* in register depending on literal "LL_ADC_INJ_RANK_x". */
Kojto 122:f9eeca106725 4413 /* Parameters "Rankx_Channel" and "LL_ADC_INJ_RANK_x" are used with masks */
Kojto 122:f9eeca106725 4414 /* because containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4415 /* If parameter "TriggerSource" is set to SW start, then parameter */
Kojto 122:f9eeca106725 4416 /* "ExternalTriggerEdge" is discarded. */
Kojto 122:f9eeca106725 4417 MODIFY_REG(ADCx->JSQR ,
Kojto 122:f9eeca106725 4418 ADC_JSQR_JEXTSEL |
Kojto 122:f9eeca106725 4419 ADC_JSQR_JEXTEN |
Kojto 122:f9eeca106725 4420 ADC_JSQR_JSQ4 |
Kojto 122:f9eeca106725 4421 ADC_JSQR_JSQ3 |
Kojto 122:f9eeca106725 4422 ADC_JSQR_JSQ2 |
Kojto 122:f9eeca106725 4423 ADC_JSQR_JSQ1 |
Kojto 122:f9eeca106725 4424 ADC_JSQR_JL ,
Kojto 122:f9eeca106725 4425 TriggerSource |
Kojto 122:f9eeca106725 4426 (ExternalTriggerEdge * ((TriggerSource != LL_ADC_INJ_TRIG_SOFTWARE))) |
Kojto 122:f9eeca106725 4427 ((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 4428 ((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 4429 ((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 4430 ((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 4431 SequencerNbRanks
Kojto 122:f9eeca106725 4432 );
Kojto 122:f9eeca106725 4433 }
Kojto 122:f9eeca106725 4434
Kojto 122:f9eeca106725 4435 /**
Kojto 122:f9eeca106725 4436 * @}
Kojto 122:f9eeca106725 4437 */
Kojto 122:f9eeca106725 4438
Kojto 122:f9eeca106725 4439 /** @defgroup ADC_LL_EF_Configuration_Channels Configuration of ADC hierarchical scope: channels
Kojto 122:f9eeca106725 4440 * @{
Kojto 122:f9eeca106725 4441 */
Kojto 122:f9eeca106725 4442
Kojto 122:f9eeca106725 4443 /**
Kojto 122:f9eeca106725 4444 * @brief Set sampling time of the selected ADC channel
Kojto 122:f9eeca106725 4445 * Unit: ADC clock cycles.
Kojto 122:f9eeca106725 4446 * @note On this device, sampling time is on channel scope: independently
Kojto 122:f9eeca106725 4447 * of channel mapped on ADC group regular or injected.
Kojto 122:f9eeca106725 4448 * @note In case of internal channel (VrefInt, TempSensor, ...) to be
Kojto 122:f9eeca106725 4449 * converted:
Kojto 122:f9eeca106725 4450 * sampling time constraints must be respected (sampling time can be
Kojto 122:f9eeca106725 4451 * adjusted in function of ADC clock frequency and sampling time
Kojto 122:f9eeca106725 4452 * setting).
Kojto 122:f9eeca106725 4453 * Refer to device datasheet for timings values (parameters TS_vrefint,
Kojto 122:f9eeca106725 4454 * TS_temp, ...).
Kojto 122:f9eeca106725 4455 * @note Conversion time is the addition of sampling time and processing time.
Kojto 122:f9eeca106725 4456 * On this STM32 serie, ADC processing time is:
Kojto 122:f9eeca106725 4457 * - 12.5 ADC clock cycles at ADC resolution 12 bits
Kojto 122:f9eeca106725 4458 * - 10.5 ADC clock cycles at ADC resolution 10 bits
Kojto 122:f9eeca106725 4459 * - 8.5 ADC clock cycles at ADC resolution 8 bits
Kojto 122:f9eeca106725 4460 * - 6.5 ADC clock cycles at ADC resolution 6 bits
Kojto 122:f9eeca106725 4461 * @note In case of ADC conversion of internal channel (VrefInt,
Kojto 122:f9eeca106725 4462 * temperature sensor, ...), a sampling time minimum value
Kojto 122:f9eeca106725 4463 * is required.
Kojto 122:f9eeca106725 4464 * Refer to device datasheet.
Kojto 122:f9eeca106725 4465 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4466 * ADC state:
Kojto 122:f9eeca106725 4467 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4468 * on either groups regular or injected.
Kojto 122:f9eeca106725 4469 * @rmtoll SMPR1 SMP0 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4470 * SMPR1 SMP1 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4471 * SMPR1 SMP2 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4472 * SMPR1 SMP3 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4473 * SMPR1 SMP4 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4474 * SMPR1 SMP5 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4475 * SMPR1 SMP6 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4476 * SMPR1 SMP7 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4477 * SMPR1 SMP8 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4478 * SMPR1 SMP9 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4479 * SMPR2 SMP10 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4480 * SMPR2 SMP11 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4481 * SMPR2 SMP12 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4482 * SMPR2 SMP13 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4483 * SMPR2 SMP14 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4484 * SMPR2 SMP15 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4485 * SMPR2 SMP16 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4486 * SMPR2 SMP17 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4487 * SMPR2 SMP18 LL_ADC_SetChannelSamplingTime
Kojto 122:f9eeca106725 4488 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4489 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4490 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4491 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4492 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4493 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4494 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4495 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4496 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4497 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4498 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4499 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4500 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4501 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4502 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4503 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4504 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4505 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4506 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4507 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4508 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4509 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4510 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4511 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4512 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4513 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4514 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4515 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4516 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4517 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4518 *
Kojto 122:f9eeca106725 4519 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4520 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4521 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4522 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4523 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4524 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4525 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4526 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4527 * @param SamplingTime This parameter can be one of the following values:
Kojto 122:f9eeca106725 4528 * @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5
Kojto 122:f9eeca106725 4529 * @arg @ref LL_ADC_SAMPLINGTIME_6CYCLES_5
Kojto 122:f9eeca106725 4530 * @arg @ref LL_ADC_SAMPLINGTIME_12CYCLES_5
Kojto 122:f9eeca106725 4531 * @arg @ref LL_ADC_SAMPLINGTIME_24CYCLES_5
Kojto 122:f9eeca106725 4532 * @arg @ref LL_ADC_SAMPLINGTIME_47CYCLES_5
Kojto 122:f9eeca106725 4533 * @arg @ref LL_ADC_SAMPLINGTIME_92CYCLES_5
Kojto 122:f9eeca106725 4534 * @arg @ref LL_ADC_SAMPLINGTIME_247CYCLES_5
Kojto 122:f9eeca106725 4535 * @arg @ref LL_ADC_SAMPLINGTIME_640CYCLES_5
Kojto 122:f9eeca106725 4536 * @retval None
Kojto 122:f9eeca106725 4537 */
Kojto 122:f9eeca106725 4538 __STATIC_INLINE void LL_ADC_SetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
Kojto 122:f9eeca106725 4539 {
Kojto 122:f9eeca106725 4540 /* Set bits with content of parameter "SamplingTime" with bits position */
Kojto 122:f9eeca106725 4541 /* in register and register position depending on parameter "Channel". */
Kojto 122:f9eeca106725 4542 /* Parameter "Channel" is used with masks because containing */
Kojto 122:f9eeca106725 4543 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4544 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 4545
Kojto 122:f9eeca106725 4546 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 4547 ADC_SMPR1_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK),
Kojto 122:f9eeca106725 4548 SamplingTime << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK));
Kojto 122:f9eeca106725 4549 }
Kojto 122:f9eeca106725 4550
Kojto 122:f9eeca106725 4551 /**
Kojto 122:f9eeca106725 4552 * @brief Get sampling time of the selected ADC channel
Kojto 122:f9eeca106725 4553 * Unit: ADC clock cycles.
Kojto 122:f9eeca106725 4554 * @note On this device, sampling time is on channel scope: independently
Kojto 122:f9eeca106725 4555 * of channel mapped on ADC group regular or injected.
Kojto 122:f9eeca106725 4556 * @note Conversion time is the addition of sampling time and processing time.
Kojto 122:f9eeca106725 4557 * On this STM32 serie, ADC processing time is:
Kojto 122:f9eeca106725 4558 * - 12.5 ADC clock cycles at ADC resolution 12 bits
Kojto 122:f9eeca106725 4559 * - 10.5 ADC clock cycles at ADC resolution 10 bits
Kojto 122:f9eeca106725 4560 * - 8.5 ADC clock cycles at ADC resolution 8 bits
Kojto 122:f9eeca106725 4561 * - 6.5 ADC clock cycles at ADC resolution 6 bits
Kojto 122:f9eeca106725 4562 * @rmtoll SMPR1 SMP0 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4563 * SMPR1 SMP1 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4564 * SMPR1 SMP2 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4565 * SMPR1 SMP3 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4566 * SMPR1 SMP4 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4567 * SMPR1 SMP5 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4568 * SMPR1 SMP6 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4569 * SMPR1 SMP7 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4570 * SMPR1 SMP8 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4571 * SMPR1 SMP9 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4572 * SMPR2 SMP10 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4573 * SMPR2 SMP11 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4574 * SMPR2 SMP12 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4575 * SMPR2 SMP13 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4576 * SMPR2 SMP14 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4577 * SMPR2 SMP15 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4578 * SMPR2 SMP16 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4579 * SMPR2 SMP17 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4580 * SMPR2 SMP18 LL_ADC_GetChannelSamplingTime
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 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4621 * @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5
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
Kojto 122:f9eeca106725 4629 */
Kojto 122:f9eeca106725 4630 __STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel)
Kojto 122:f9eeca106725 4631 {
Kojto 122:f9eeca106725 4632 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 4633
Kojto 122:f9eeca106725 4634 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 4635 ADC_SMPR1_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK))
Kojto 122:f9eeca106725 4636 >> __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK)
Kojto 122:f9eeca106725 4637 );
Kojto 122:f9eeca106725 4638 }
Kojto 122:f9eeca106725 4639
Kojto 122:f9eeca106725 4640 /**
Kojto 122:f9eeca106725 4641 * @brief Set mode single-ended or differential input of the selected
Kojto 122:f9eeca106725 4642 * ADC channel.
Kojto 122:f9eeca106725 4643 * @note Channel ending is on channel scope: independently of channel mapped
Kojto 122:f9eeca106725 4644 * on ADC group regular or injected.
Kojto 122:f9eeca106725 4645 * In differential mode: Differential measurement is carried out
Kojto 122:f9eeca106725 4646 * between the selected channel 'i' (positive input) and
Kojto 122:f9eeca106725 4647 * channel 'i+1' (negative input). Only channel 'i' has to be
Kojto 122:f9eeca106725 4648 * configured, channel 'i+1' is configured automatically.
Kojto 122:f9eeca106725 4649 * @note Refer to Reference Manual to ensure the selected channel is
Kojto 122:f9eeca106725 4650 * available in differential mode.
Kojto 122:f9eeca106725 4651 * For example, internal channels (VrefInt, TempSensor, ...) are
Kojto 122:f9eeca106725 4652 * not available in differential mode.
Kojto 122:f9eeca106725 4653 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4654 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4655 * @note On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available)
Kojto 122:f9eeca106725 4656 * are internally fixed to single-ended inputs configuration.
Kojto 122:f9eeca106725 4657 * @note For ADC channels configured in differential mode, both inputs
Kojto 122:f9eeca106725 4658 * should be biased at (Vref+)/2 +/-200mV.
Kojto 122:f9eeca106725 4659 * (Vref+ is the analog voltage reference)
Kojto 122:f9eeca106725 4660 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4661 * ADC state:
Kojto 122:f9eeca106725 4662 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 4663 * @note One or several values can be selected.
Kojto 122:f9eeca106725 4664 * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Kojto 122:f9eeca106725 4665 * @rmtoll DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Kojto 122:f9eeca106725 4666 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4667 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4668 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 4669 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 4670 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 4671 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 4672 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 4673 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4674 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4675 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4676 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4677 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4678 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4679 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4680 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4681 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4682 * @param SingleDiff This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 4683 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 4684 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 4685 * @retval None
Kojto 122:f9eeca106725 4686 */
Kojto 122:f9eeca106725 4687 __STATIC_INLINE void LL_ADC_SetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
Kojto 122:f9eeca106725 4688 {
Kojto 122:f9eeca106725 4689 /* Bits of channels in single or differential mode are set only for */
Kojto 122:f9eeca106725 4690 /* differential mode (for single mode, mask of bits allowed to be set is */
Kojto 122:f9eeca106725 4691 /* shifted out of range of bits of channels in single or differential mode. */
Kojto 122:f9eeca106725 4692 MODIFY_REG(ADCx->DIFSEL,
Kojto 122:f9eeca106725 4693 Channel & ADC_SINGLEDIFF_CHANNEL_MASK,
Kojto 122:f9eeca106725 4694 (Channel & ADC_SINGLEDIFF_CHANNEL_MASK) & (ADC_DIFSEL_DIFSEL << (SingleDiff & ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK)));
Kojto 122:f9eeca106725 4695 }
Kojto 122:f9eeca106725 4696
Kojto 122:f9eeca106725 4697 /**
Kojto 122:f9eeca106725 4698 * @brief Get mode single-ended or differential input of the selected
Kojto 122:f9eeca106725 4699 * ADC channel.
Kojto 122:f9eeca106725 4700 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4701 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4702 * Therefore, to ensure a channel is configured in single-ended mode,
Kojto 122:f9eeca106725 4703 * the configuration of channel itself and the channel 'i-1' must be
Kojto 122:f9eeca106725 4704 * read back (to ensure that the selected channel channel has not been
Kojto 122:f9eeca106725 4705 * configured in differential mode by the previous channel).
Kojto 122:f9eeca106725 4706 * @note Refer to Reference Manual to ensure the selected channel is
Kojto 122:f9eeca106725 4707 * available in differential mode.
Kojto 122:f9eeca106725 4708 * For example, internal channels (VrefInt, TempSensor, ...) are
Kojto 122:f9eeca106725 4709 * not available in differential mode.
Kojto 122:f9eeca106725 4710 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4711 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4712 * @note On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available)
Kojto 122:f9eeca106725 4713 * are internally fixed to single-ended inputs configuration.
Kojto 122:f9eeca106725 4714 * @note One or several values can be selected. In this case, the value
Kojto 122:f9eeca106725 4715 * returned is null if all channels are in single ended-mode.
Kojto 122:f9eeca106725 4716 * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Kojto 122:f9eeca106725 4717 * @rmtoll DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Kojto 122:f9eeca106725 4718 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4719 * @param Channel This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 4720 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4721 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 4722 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 4723 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 4724 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 4725 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 4726 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4727 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4728 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4729 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4730 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4731 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4732 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4733 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4734 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4735 * @retval 0: channel in single-ended mode, else: channel in differential mode
Kojto 122:f9eeca106725 4736 */
Kojto 122:f9eeca106725 4737 __STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel)
Kojto 122:f9eeca106725 4738 {
Kojto 122:f9eeca106725 4739 return (uint32_t)(READ_BIT(ADCx->DIFSEL, (Channel & ADC_SINGLEDIFF_CHANNEL_MASK)));
Kojto 122:f9eeca106725 4740 }
Kojto 122:f9eeca106725 4741
Kojto 122:f9eeca106725 4742 /**
Kojto 122:f9eeca106725 4743 * @}
Kojto 122:f9eeca106725 4744 */
Kojto 122:f9eeca106725 4745
Kojto 122:f9eeca106725 4746 /** @defgroup ADC_LL_EF_Configuration_ADC_AnalogWatchdog Configuration of ADC transversal scope: analog watchdog
Kojto 122:f9eeca106725 4747 * @{
Kojto 122:f9eeca106725 4748 */
Kojto 122:f9eeca106725 4749
Kojto 122:f9eeca106725 4750 /**
Kojto 122:f9eeca106725 4751 * @brief Set ADC analog watchdog monitored channels:
Kojto 122:f9eeca106725 4752 * a single channel, multiple channels or all channels,
Kojto 122:f9eeca106725 4753 * on ADC groups regular and-or injected.
Kojto 122:f9eeca106725 4754 * @note Once monitored channels are selected, analog watchdog
Kojto 122:f9eeca106725 4755 * is enabled.
Kojto 122:f9eeca106725 4756 * @note In case of need to define a single channel to monitor
Kojto 122:f9eeca106725 4757 * with analog watchdog from sequencer channel definition,
Kojto 122:f9eeca106725 4758 * use helper macro @ref __LL_ADC_ANALOGWD_CHANNEL_GROUP().
Kojto 122:f9eeca106725 4759 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 4760 * instance:
Kojto 122:f9eeca106725 4761 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 4762 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 4763 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 4764 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 4765 * ADC resolution configured).
Kojto 122:f9eeca106725 4766 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 4767 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 4768 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 4769 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 4770 * be selected. For example:
Kojto 122:f9eeca106725 4771 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 4772 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 4773 * groups regular and injected).
Kojto 122:f9eeca106725 4774 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 4775 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 4776 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 4777 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 4778 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 4779 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 4780 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4781 * ADC state:
Kojto 122:f9eeca106725 4782 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4783 * on either groups regular or injected.
Kojto 122:f9eeca106725 4784 * @rmtoll CFGR AWD1CH LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4785 * CFGR AWD1SGL LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4786 * CFGR AWD1EN LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4787 * CFGR JAWD1EN LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4788 * AWD2CR AWD2CH LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4789 * AWD3CR AWD3CH LL_ADC_SetAnalogWDMonitChannels
Kojto 122:f9eeca106725 4790 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4791 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 4792 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 4793 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 4794 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 4795 * @param AWDChannelGroup This parameter can be one of the following values:
Kojto 122:f9eeca106725 4796 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 4797 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 4798 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 4799 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 4800 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 4801 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 4802 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 4803 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 4804 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 4805 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 4806 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 4807 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 4808 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 4809 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 4810 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 4811 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 4812 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 4813 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 4814 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 4815 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 4816 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 4817 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 4818 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 4819 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 4820 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 4821 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 4822 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 4823 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 4824 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 4825 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 4826 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 4827 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 4828 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 4829 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 4830 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 4831 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 4832 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 4833 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 4834 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 4835 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 4836 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 4837 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 4838 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 4839 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 4840 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 4841 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 4842 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 4843 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 4844 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 4845 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 4846 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 4847 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 4848 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 4849 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 4850 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 4851 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 4852 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 4853 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 4854 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 4855 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 4856 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 4857 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (0)(1)
Kojto 122:f9eeca106725 4858 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (0)(1)
Kojto 122:f9eeca106725 4859 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
Kojto 122:f9eeca106725 4860 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (0)(4)
Kojto 122:f9eeca106725 4861 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (0)(4)
Kojto 122:f9eeca106725 4862 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (4)
Kojto 122:f9eeca106725 4863 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (0)(4)
Kojto 122:f9eeca106725 4864 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (0)(4)
Kojto 122:f9eeca106725 4865 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (4)
Kojto 122:f9eeca106725 4866 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG (0)(2)(5)
Kojto 122:f9eeca106725 4867 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_INJ (0)(2)(5)
Kojto 122:f9eeca106725 4868 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG_INJ (2)(5)
Kojto 122:f9eeca106725 4869 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG (0)(2)(5)
Kojto 122:f9eeca106725 4870 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_INJ (0)(2)(5)
Kojto 122:f9eeca106725 4871 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG_INJ (2)(5)
Kojto 122:f9eeca106725 4872 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 4873 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 4874 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 4875 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 4876 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 4877 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 4878 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 4879 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 4880 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 4881 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 4882 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 4883 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 4884 *
Kojto 122:f9eeca106725 4885 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.\n
Kojto 122:f9eeca106725 4886 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4887 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4888 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4889 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
Kojto 122:f9eeca106725 4890 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4891 * (6) On STM32L4, parameter available on devices with several ADC instances.
Kojto 122:f9eeca106725 4892 * @retval None
Kojto 122:f9eeca106725 4893 */
Kojto 122:f9eeca106725 4894 __STATIC_INLINE void LL_ADC_SetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDChannelGroup)
Kojto 122:f9eeca106725 4895 {
Kojto 122:f9eeca106725 4896 /* Set bits with content of parameter "AWDChannelGroup" with bits position */
Kojto 122:f9eeca106725 4897 /* in register and register position depending on parameter "AWDy". */
Kojto 122:f9eeca106725 4898 /* Parameters "AWDChannelGroup" and "AWDy" are used with masks because */
Kojto 122:f9eeca106725 4899 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4900 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, __ADC_MASK_SHIFT(AWDy, ADC_AWD_CRX_REGOFFSET_MASK)
Kojto 122:f9eeca106725 4901 + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
Kojto 122:f9eeca106725 4902
Kojto 122:f9eeca106725 4903 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 4904 (AWDy & ADC_AWD_CR_ALL_CHANNEL_MASK),
Kojto 122:f9eeca106725 4905 AWDChannelGroup & AWDy);
Kojto 122:f9eeca106725 4906 }
Kojto 122:f9eeca106725 4907
Kojto 122:f9eeca106725 4908 /**
Kojto 122:f9eeca106725 4909 * @brief Get ADC analog watchdog monitored channel.
Kojto 122:f9eeca106725 4910 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 4911 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 4912 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 4913 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 4914 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 4915 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4916 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 4917 * as parameter for another function.
Kojto 122:f9eeca106725 4918 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 4919 * process the returned value with the helper macro
Kojto 122:f9eeca106725 4920 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4921 * Applicable only when the analog watchdog is set to monitor
Kojto 122:f9eeca106725 4922 * one channel.
Kojto 122:f9eeca106725 4923 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 4924 * instance:
Kojto 122:f9eeca106725 4925 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 4926 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 4927 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 4928 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 4929 * ADC resolution configured).
Kojto 122:f9eeca106725 4930 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 4931 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 4932 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 4933 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 4934 * be selected. For example:
Kojto 122:f9eeca106725 4935 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 4936 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 4937 * groups regular and injected).
Kojto 122:f9eeca106725 4938 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 4939 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 4940 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 4941 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 4942 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 4943 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 4944 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4945 * ADC state:
Kojto 122:f9eeca106725 4946 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4947 * on either groups regular or injected.
Kojto 122:f9eeca106725 4948 * @rmtoll CFGR AWD1CH LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4949 * CFGR AWD1SGL LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4950 * CFGR AWD1EN LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4951 * CFGR JAWD1EN LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4952 * AWD2CR AWD2CH LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4953 * AWD3CR AWD3CH LL_ADC_GetAnalogWDMonitChannels
Kojto 122:f9eeca106725 4954 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4955 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 4956 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 4957 * @arg @ref LL_ADC_AWD2 (1)
Kojto 122:f9eeca106725 4958 * @arg @ref LL_ADC_AWD3 (1)
Kojto 122:f9eeca106725 4959 *
Kojto 122:f9eeca106725 4960 * (1) On this AWD number, monitored channel can be retrieved
Kojto 122:f9eeca106725 4961 * if only 1 channel is programmed (or none or all channels).
Kojto 122:f9eeca106725 4962 * This function cannot retrieve monitored channel if
Kojto 122:f9eeca106725 4963 * multiple channels are programmed simultaneously
Kojto 122:f9eeca106725 4964 * by bitfield.
Kojto 122:f9eeca106725 4965 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4966 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 4967 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 4968 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 4969 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 4970 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 4971 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 4972 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 4973 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 4974 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 4975 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 4976 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 4977 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 4978 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 4979 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 4980 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 4981 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 4982 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 4983 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 4984 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 4985 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 4986 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 4987 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 4988 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 4989 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 4990 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 4991 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 4992 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 4993 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 4994 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 4995 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 4996 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 4997 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 4998 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 4999 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 5000 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 5001 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 5002 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 5003 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 5004 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 5005 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 5006 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 5007 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 5008 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 5009 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 5010 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 5011 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 5012 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 5013 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 5014 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 5015 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 5016 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 5017 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 5018 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 5019 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 5020 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 5021 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 5022 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 5023 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 5024 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 5025 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 5026 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 5027 *
Kojto 122:f9eeca106725 5028 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.
Kojto 122:f9eeca106725 5029 */
Kojto 122:f9eeca106725 5030 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy)
Kojto 122:f9eeca106725 5031 {
Kojto 122:f9eeca106725 5032 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, __ADC_MASK_SHIFT(AWDy, ADC_AWD_CRX_REGOFFSET_MASK)
Kojto 122:f9eeca106725 5033 + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
Kojto 122:f9eeca106725 5034
Kojto 122:f9eeca106725 5035 /* Variable "AWDy" used to retrieve appropriate bitfield corresponding to */
Kojto 122:f9eeca106725 5036 /* ADC_AWD_CR1_CHANNEL_MASK or ADC_AWD_CR23_CHANNEL_MASK. */
Kojto 122:f9eeca106725 5037 register uint32_t AWD123ChannelGroup = READ_BIT(*preg, (AWDy | ADC_AWD_CR_ALL_CHANNEL_MASK));
Kojto 122:f9eeca106725 5038
Kojto 122:f9eeca106725 5039 /* Set variable of AWD1 monitored channel according to AWD1 features */
Kojto 122:f9eeca106725 5040 /* and ADC channel definition: */
Kojto 122:f9eeca106725 5041 /* - channel ID with number */
Kojto 122:f9eeca106725 5042 /* - channel ID with bitfield */
Kojto 122:f9eeca106725 5043 /* - AWD1 single or all channels */
Kojto 122:f9eeca106725 5044 /* - AWD1 enable or disable (also used to discard AWD1 bitfield in case of */
Kojto 122:f9eeca106725 5045 /* AWD2 or AWD3 selected). */
Kojto 122:f9eeca106725 5046 register uint32_t AWD1ChannelSingle = ((AWD123ChannelGroup & ADC_CFGR_AWD1SGL) >> ADC_CFGR_AWD1SGL_BITOFFSET_POS);
Kojto 122:f9eeca106725 5047
Kojto 122:f9eeca106725 5048 register uint32_t AWD1ChannelGroup = ( ( AWD123ChannelGroup
Kojto 122:f9eeca106725 5049 | ((ADC_CHANNEL_0_BITFIELD << ((AWD123ChannelGroup & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)) * AWD1ChannelSingle)
Kojto 122:f9eeca106725 5050 | (ADC_CHANNEL_ID_BITFIELD_MASK * (~AWD1ChannelSingle & ((uint32_t)0x00000001U)))
Kojto 122:f9eeca106725 5051 )
Kojto 122:f9eeca106725 5052 * (((AWD123ChannelGroup & ADC_CFGR_JAWD1EN) >> ADC_CFGR_JAWD1EN_BITOFFSET_POS) | ((AWD123ChannelGroup & ADC_CFGR_AWD1EN) >> ADC_CFGR_AWD1EN_BITOFFSET_POS))
Kojto 122:f9eeca106725 5053 );
Kojto 122:f9eeca106725 5054
Kojto 122:f9eeca106725 5055 /* Set variable of AWD2 and AWD3 monitored channel according to AWD2-3 */
Kojto 122:f9eeca106725 5056 /* features and ADC channel definition: */
Kojto 122:f9eeca106725 5057 /* - channel ID with number */
Kojto 122:f9eeca106725 5058 /* - channel ID with bitfield */
Kojto 122:f9eeca106725 5059 /* - AWD2-3 single or all channels (shift value 32 (0x1 shift 5) used to */
Kojto 122:f9eeca106725 5060 /* shift AWD1 equivalent single-all channels out of register) */
Kojto 122:f9eeca106725 5061 /* - AWD2-3 enable or disable */
Kojto 122:f9eeca106725 5062 /* Note: Use modulo 3 to avoid a shift value too long. On AWD2 and AWD3, */
Kojto 122:f9eeca106725 5063 /* channel can be read back if only 1 channel monitoring */
Kojto 122:f9eeca106725 5064 /* is activated, therefore the channel monitoring value channel "3" */
Kojto 122:f9eeca106725 5065 /* is not not supported by this function, there is no risk of */
Kojto 122:f9eeca106725 5066 /* conflict. */
Kojto 122:f9eeca106725 5067 register uint32_t AWD23Enabled = ((((uint32_t)0x00000001U) >> (AWD123ChannelGroup % 3U)) << 6U); /* Value "0" if AWD2-3 is enabled, value "32" if AWD2-3 is disabled */
Kojto 122:f9eeca106725 5068
Kojto 122:f9eeca106725 5069 register uint32_t AWD23ChannelGroup = ((( AWD123ChannelGroup
Kojto 122:f9eeca106725 5070 | ((uint32_t)POSITION_VAL(AWD123ChannelGroup) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)
Kojto 122:f9eeca106725 5071 | ((ADC_CFGR_AWD1SGL) >> ((((uint32_t)0x00000001U) >> (ADC_AWD_CR23_CHANNEL_MASK - AWD123ChannelGroup)) << 5U))
Kojto 122:f9eeca106725 5072 | (ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN)
Kojto 122:f9eeca106725 5073 ) >> AWD23Enabled
Kojto 122:f9eeca106725 5074 ) >> (((AWDy & ADC_CFGR_AWD1SGL) >> ADC_CFGR_AWD1SGL_BITOFFSET_POS) << 5U));
Kojto 122:f9eeca106725 5075
Kojto 122:f9eeca106725 5076 return (AWD1ChannelGroup | AWD23ChannelGroup);
Kojto 122:f9eeca106725 5077 }
Kojto 122:f9eeca106725 5078
Kojto 122:f9eeca106725 5079 /**
Kojto 122:f9eeca106725 5080 * @brief Set ADC analog watchdog thresholds value of both thresholds
Kojto 122:f9eeca106725 5081 * high and low.
Kojto 122:f9eeca106725 5082 * @note If value of only one threshold high or low must be set,
Kojto 122:f9eeca106725 5083 * use function @ref LL_ADC_SetAnalogWDThresholds().
Kojto 122:f9eeca106725 5084 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5085 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5086 * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5087 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 5088 * instance:
Kojto 122:f9eeca106725 5089 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 5090 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 5091 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 5092 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 5093 * ADC resolution configured).
Kojto 122:f9eeca106725 5094 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 5095 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 5096 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 5097 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 5098 * be selected. For example:
Kojto 122:f9eeca106725 5099 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 5100 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 5101 * groups regular and injected).
Kojto 122:f9eeca106725 5102 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 5103 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 5104 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 5105 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 5106 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 5107 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 5108 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5109 * ADC state:
Kojto 122:f9eeca106725 5110 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5111 * on either groups regular or injected.
Kojto 122:f9eeca106725 5112 * @rmtoll TR1 HT1 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5113 * TR2 HT2 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5114 * TR3 HT3 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5115 * TR1 LT1 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5116 * TR2 LT2 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5117 * TR3 LT3 LL_ADC_ConfigAnalogWDThresholds
Kojto 122:f9eeca106725 5118 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5119 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5120 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5121 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5122 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5123 * @param AWDThresholdHighValue Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5124 * @param AWDThresholdLowValue Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5125 * @retval None
Kojto 122:f9eeca106725 5126 */
Kojto 122:f9eeca106725 5127 __STATIC_INLINE void LL_ADC_ConfigAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdHighValue, uint32_t AWDThresholdLowValue)
Kojto 122:f9eeca106725 5128 {
Kojto 122:f9eeca106725 5129 /* Set bits with content of parameter "AWDThresholdxxxValue" with bits */
Kojto 122:f9eeca106725 5130 /* position in register and register position depending on parameter */
Kojto 122:f9eeca106725 5131 /* "AWDy". */
Kojto 122:f9eeca106725 5132 /* Parameters "AWDy" and "AWDThresholdxxxValue" are used with masks because */
Kojto 122:f9eeca106725 5133 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 5134 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->TR1, __ADC_MASK_SHIFT(AWDy, ADC_AWD_TRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 5135
Kojto 122:f9eeca106725 5136 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 5137 ADC_TR1_HT1 | ADC_TR1_LT1,
Kojto 122:f9eeca106725 5138 (AWDThresholdHighValue << ADC_TR1_HT1_BITOFFSET_POS) | AWDThresholdLowValue);
Kojto 122:f9eeca106725 5139 }
Kojto 122:f9eeca106725 5140
Kojto 122:f9eeca106725 5141 /**
Kojto 122:f9eeca106725 5142 * @brief Set ADC analog watchdog threshold value of threshold
Kojto 122:f9eeca106725 5143 * high or low.
Kojto 122:f9eeca106725 5144 * @note If values of both thresholds high or low must be set,
Kojto 122:f9eeca106725 5145 * use function @ref LL_ADC_ConfigAnalogWDThresholds().
Kojto 122:f9eeca106725 5146 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5147 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5148 * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5149 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 5150 * instance:
Kojto 122:f9eeca106725 5151 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 5152 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 5153 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 5154 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 5155 * ADC resolution configured).
Kojto 122:f9eeca106725 5156 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 5157 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 5158 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 5159 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 5160 * be selected. For example:
Kojto 122:f9eeca106725 5161 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 5162 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 5163 * groups regular and injected).
Kojto 122:f9eeca106725 5164 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 5165 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 5166 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 5167 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 5168 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 5169 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 5170 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5171 * ADC state:
Kojto 122:f9eeca106725 5172 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5173 * on either groups regular or injected.
Kojto 122:f9eeca106725 5174 * @rmtoll TR1 HT1 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5175 * TR2 HT2 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5176 * TR3 HT3 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5177 * TR1 LT1 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5178 * TR2 LT2 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5179 * TR3 LT3 LL_ADC_SetAnalogWDThresholds
Kojto 122:f9eeca106725 5180 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5181 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5182 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5183 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5184 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5185 * @param AWDThresholdsHighLow This parameter can be one of the following values:
Kojto 122:f9eeca106725 5186 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 5187 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 5188 * @param AWDThresholdValue: Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5189 * @retval None
Kojto 122:f9eeca106725 5190 */
Kojto 122:f9eeca106725 5191 __STATIC_INLINE void LL_ADC_SetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue)
Kojto 122:f9eeca106725 5192 {
Kojto 122:f9eeca106725 5193 /* Set bits with content of parameter "AWDThresholdValue" with bits */
Kojto 122:f9eeca106725 5194 /* position in register and register position depending on parameters */
Kojto 122:f9eeca106725 5195 /* "AWDThresholdsHighLow" and "AWDy". */
Kojto 122:f9eeca106725 5196 /* Parameters "AWDy" and "AWDThresholdValue" are used with masks because */
Kojto 122:f9eeca106725 5197 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 5198 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->TR1, __ADC_MASK_SHIFT(AWDy, ADC_AWD_TRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 5199
Kojto 122:f9eeca106725 5200 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 5201 AWDThresholdsHighLow,
Kojto 122:f9eeca106725 5202 AWDThresholdValue << POSITION_VAL(AWDThresholdsHighLow));
Kojto 122:f9eeca106725 5203 }
Kojto 122:f9eeca106725 5204
Kojto 122:f9eeca106725 5205 /**
Kojto 122:f9eeca106725 5206 * @brief Get ADC analog watchdog threshold value of threshold high,
Kojto 122:f9eeca106725 5207 * threshold low or raw data with ADC thresholds high and low
Kojto 122:f9eeca106725 5208 * concatenated.
Kojto 122:f9eeca106725 5209 * @note If raw data with ADC thresholds high and low is retrieved,
Kojto 122:f9eeca106725 5210 * the data of each threshold high or low can be isolated
Kojto 122:f9eeca106725 5211 * using helper macro:
Kojto 122:f9eeca106725 5212 * @ref __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW().
Kojto 122:f9eeca106725 5213 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5214 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5215 * Use helper macro @ref __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5216 * @rmtoll TR1 HT1 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5217 * TR2 HT2 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5218 * TR3 HT3 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5219 * TR1 LT1 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5220 * TR2 LT2 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5221 * TR3 LT3 LL_ADC_GetAnalogWDThresholds
Kojto 122:f9eeca106725 5222 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5223 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5224 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5225 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5226 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5227 * @param AWDThresholdsHighLow This parameter can be one of the following values:
Kojto 122:f9eeca106725 5228 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 5229 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 5230 * @arg @ref LL_ADC_AWD_THRESHOLDS_HIGH_LOW
Kojto 122:f9eeca106725 5231 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5232 */
Kojto 122:f9eeca106725 5233 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow)
Kojto 122:f9eeca106725 5234 {
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 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 5238 (AWDThresholdsHighLow | ADC_TR1_LT1))
Kojto 122:f9eeca106725 5239 >> POSITION_VAL(AWDThresholdsHighLow)
Kojto 122:f9eeca106725 5240 );
Kojto 122:f9eeca106725 5241 }
Kojto 122:f9eeca106725 5242
Kojto 122:f9eeca106725 5243 /**
Kojto 122:f9eeca106725 5244 * @}
Kojto 122:f9eeca106725 5245 */
Kojto 122:f9eeca106725 5246
Kojto 122:f9eeca106725 5247 /** @defgroup ADC_LL_EF_Configuration_ADC_oversampling Configuration of ADC transversal scope: oversampling
Kojto 122:f9eeca106725 5248 * @{
Kojto 122:f9eeca106725 5249 */
Kojto 122:f9eeca106725 5250
Kojto 122:f9eeca106725 5251 /**
Kojto 122:f9eeca106725 5252 * @brief Set ADC oversampling scope: ADC groups regular and-or injected
Kojto 122:f9eeca106725 5253 * (availability of ADC group injected depends on STM32 families).
Kojto 122:f9eeca106725 5254 * @note If both groups regular and injected are selected,
Kojto 122:f9eeca106725 5255 * specify behavior of ADC group injected interrupting
Kojto 122:f9eeca106725 5256 * group regular: when ADC group injected is triggered,
Kojto 122:f9eeca106725 5257 * the oversampling on ADC group regular is either
Kojto 122:f9eeca106725 5258 * temporary stopped and continued, or resumed from start
Kojto 122:f9eeca106725 5259 * (oversampler buffer reset).
Kojto 122:f9eeca106725 5260 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5261 * ADC state:
Kojto 122:f9eeca106725 5262 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5263 * on either groups regular or injected.
Kojto 122:f9eeca106725 5264 * @rmtoll CFGR2 ROVSE LL_ADC_SetOverSamplingScope\n
Kojto 122:f9eeca106725 5265 * CFGR2 JOVSE LL_ADC_SetOverSamplingScope\n
Kojto 122:f9eeca106725 5266 * CFGR2 ROVSM LL_ADC_SetOverSamplingScope
Kojto 122:f9eeca106725 5267 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5268 * @param OvsScope This parameter can be one of the following values:
Kojto 122:f9eeca106725 5269 * @arg @ref LL_ADC_OVS_DISABLE
Kojto 122:f9eeca106725 5270 * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
Kojto 122:f9eeca106725 5271 * @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
Kojto 122:f9eeca106725 5272 * @arg @ref LL_ADC_OVS_GRP_INJECTED
Kojto 122:f9eeca106725 5273 * @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
Kojto 122:f9eeca106725 5274 * @retval None
Kojto 122:f9eeca106725 5275 */
Kojto 122:f9eeca106725 5276 __STATIC_INLINE void LL_ADC_SetOverSamplingScope(ADC_TypeDef *ADCx, uint32_t OvsScope)
Kojto 122:f9eeca106725 5277 {
Kojto 122:f9eeca106725 5278 MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM, OvsScope);
Kojto 122:f9eeca106725 5279 }
Kojto 122:f9eeca106725 5280
Kojto 122:f9eeca106725 5281 /**
Kojto 122:f9eeca106725 5282 * @brief Get ADC oversampling scope: ADC groups regular and-or injected
Kojto 122:f9eeca106725 5283 * (availability of ADC group injected depends on STM32 families).
Kojto 122:f9eeca106725 5284 * @note If both groups regular and injected are selected,
Kojto 122:f9eeca106725 5285 * specify behavior of ADC group injected interrupting
Kojto 122:f9eeca106725 5286 * group regular: when ADC group injected is triggered,
Kojto 122:f9eeca106725 5287 * the oversampling on ADC group regular is either
Kojto 122:f9eeca106725 5288 * temporary stopped and continued, or resumed from start
Kojto 122:f9eeca106725 5289 * (oversampler buffer reset).
Kojto 122:f9eeca106725 5290 * @rmtoll CFGR2 ROVSE LL_ADC_GetOverSamplingScope\n
Kojto 122:f9eeca106725 5291 * CFGR2 JOVSE LL_ADC_GetOverSamplingScope\n
Kojto 122:f9eeca106725 5292 * CFGR2 ROVSM LL_ADC_GetOverSamplingScope
Kojto 122:f9eeca106725 5293 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5294 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5295 * @arg @ref LL_ADC_OVS_DISABLE
Kojto 122:f9eeca106725 5296 * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
Kojto 122:f9eeca106725 5297 * @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
Kojto 122:f9eeca106725 5298 * @arg @ref LL_ADC_OVS_GRP_INJECTED
Kojto 122:f9eeca106725 5299 * @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
Kojto 122:f9eeca106725 5300 */
Kojto 122:f9eeca106725 5301 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5302 {
Kojto 122:f9eeca106725 5303 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM));
Kojto 122:f9eeca106725 5304 }
Kojto 122:f9eeca106725 5305
Kojto 122:f9eeca106725 5306 /**
Kojto 122:f9eeca106725 5307 * @brief Set ADC oversampling discontinuous mode (triggered mode)
Kojto 122:f9eeca106725 5308 * on the selected ADC group.
Kojto 122:f9eeca106725 5309 * @note Number of oversampled conversions are done either in:
Kojto 122:f9eeca106725 5310 * - continuous mode (all conversions of oversampling ratio
Kojto 122:f9eeca106725 5311 * are done from 1 trigger)
Kojto 122:f9eeca106725 5312 * - discontinuous mode (each conversion of oversampling ratio
Kojto 122:f9eeca106725 5313 * needs a trigger)
Kojto 122:f9eeca106725 5314 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5315 * ADC state:
Kojto 122:f9eeca106725 5316 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5317 * on group regular.
Kojto 122:f9eeca106725 5318 * @note On this STM32 serie, oversampling discontinuous mode
Kojto 122:f9eeca106725 5319 * (triggered mode) can be used only when oversampling is
Kojto 122:f9eeca106725 5320 * set on group regular only and in resumed mode.
Kojto 122:f9eeca106725 5321 * @rmtoll CFGR2 TROVS LL_ADC_SetOverSamplingDiscont
Kojto 122:f9eeca106725 5322 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5323 * @param OverSamplingDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 5324 * @arg @ref LL_ADC_OVS_REG_CONT
Kojto 122:f9eeca106725 5325 * @arg @ref LL_ADC_OVS_REG_DISCONT
Kojto 122:f9eeca106725 5326 * @retval None
Kojto 122:f9eeca106725 5327 */
Kojto 122:f9eeca106725 5328 __STATIC_INLINE void LL_ADC_SetOverSamplingDiscont(ADC_TypeDef *ADCx, uint32_t OverSamplingDiscont)
Kojto 122:f9eeca106725 5329 {
Kojto 122:f9eeca106725 5330 MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_TROVS, OverSamplingDiscont);
Kojto 122:f9eeca106725 5331 }
Kojto 122:f9eeca106725 5332
Kojto 122:f9eeca106725 5333 /**
Kojto 122:f9eeca106725 5334 * @brief Get ADC oversampling discontinuous mode (triggered mode)
Kojto 122:f9eeca106725 5335 * on the selected ADC group.
Kojto 122:f9eeca106725 5336 * @note Number of oversampled conversions are done either in:
Kojto 122:f9eeca106725 5337 * - continuous mode (all conversions of oversampling ratio
Kojto 122:f9eeca106725 5338 * are done from 1 trigger)
Kojto 122:f9eeca106725 5339 * - discontinuous mode (each conversion of oversampling ratio
Kojto 122:f9eeca106725 5340 * needs a trigger)
Kojto 122:f9eeca106725 5341 * @rmtoll CFGR2 TROVS LL_ADC_GetOverSamplingDiscont
Kojto 122:f9eeca106725 5342 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5343 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5344 * @arg @ref LL_ADC_OVS_REG_CONT
Kojto 122:f9eeca106725 5345 * @arg @ref LL_ADC_OVS_REG_DISCONT
Kojto 122:f9eeca106725 5346 */
Kojto 122:f9eeca106725 5347 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5348 {
Kojto 122:f9eeca106725 5349 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_TROVS));
Kojto 122:f9eeca106725 5350 }
Kojto 122:f9eeca106725 5351
Kojto 122:f9eeca106725 5352 /**
Kojto 122:f9eeca106725 5353 * @brief Set ADC oversampling
Kojto 122:f9eeca106725 5354 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5355 * @note This function set the 2 items of oversampling configuration:
Kojto 122:f9eeca106725 5356 * - ratio
Kojto 122:f9eeca106725 5357 * - shift
Kojto 122:f9eeca106725 5358 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5359 * ADC state:
Kojto 122:f9eeca106725 5360 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5361 * on either groups regular or injected.
Kojto 122:f9eeca106725 5362 * @rmtoll CFGR2 OVSS LL_ADC_ConfigOverSamplingRatioShift\n
Kojto 122:f9eeca106725 5363 * CFGR2 OVSR LL_ADC_ConfigOverSamplingRatioShift
Kojto 122:f9eeca106725 5364 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5365 * @param Ratio This parameter can be one of the following values:
Kojto 122:f9eeca106725 5366 * @arg @ref LL_ADC_OVS_RATIO_2
Kojto 122:f9eeca106725 5367 * @arg @ref LL_ADC_OVS_RATIO_4
Kojto 122:f9eeca106725 5368 * @arg @ref LL_ADC_OVS_RATIO_8
Kojto 122:f9eeca106725 5369 * @arg @ref LL_ADC_OVS_RATIO_16
Kojto 122:f9eeca106725 5370 * @arg @ref LL_ADC_OVS_RATIO_32
Kojto 122:f9eeca106725 5371 * @arg @ref LL_ADC_OVS_RATIO_64
Kojto 122:f9eeca106725 5372 * @arg @ref LL_ADC_OVS_RATIO_128
Kojto 122:f9eeca106725 5373 * @arg @ref LL_ADC_OVS_RATIO_256
Kojto 122:f9eeca106725 5374 * @param Shift This parameter can be one of the following values:
Kojto 122:f9eeca106725 5375 * @arg @ref LL_ADC_OVS_SHIFT_NONE
Kojto 122:f9eeca106725 5376 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
Kojto 122:f9eeca106725 5377 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
Kojto 122:f9eeca106725 5378 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
Kojto 122:f9eeca106725 5379 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
Kojto 122:f9eeca106725 5380 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
Kojto 122:f9eeca106725 5381 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
Kojto 122:f9eeca106725 5382 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
Kojto 122:f9eeca106725 5383 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
Kojto 122:f9eeca106725 5384 * @retval None
Kojto 122:f9eeca106725 5385 */
Kojto 122:f9eeca106725 5386 __STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift(ADC_TypeDef *ADCx, uint32_t Ratio, uint32_t Shift)
Kojto 122:f9eeca106725 5387 {
Kojto 122:f9eeca106725 5388 MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_OVSS | ADC_CFGR2_OVSR), (Shift | Ratio));
Kojto 122:f9eeca106725 5389 }
Kojto 122:f9eeca106725 5390
Kojto 122:f9eeca106725 5391 /**
Kojto 122:f9eeca106725 5392 * @brief Get ADC oversampling ratio
Kojto 122:f9eeca106725 5393 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5394 * @rmtoll CFGR2 OVSR LL_ADC_GetOverSamplingRatio
Kojto 122:f9eeca106725 5395 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5396 * @retval Ratio This parameter can be one of the following values:
Kojto 122:f9eeca106725 5397 * @arg @ref LL_ADC_OVS_RATIO_2
Kojto 122:f9eeca106725 5398 * @arg @ref LL_ADC_OVS_RATIO_4
Kojto 122:f9eeca106725 5399 * @arg @ref LL_ADC_OVS_RATIO_8
Kojto 122:f9eeca106725 5400 * @arg @ref LL_ADC_OVS_RATIO_16
Kojto 122:f9eeca106725 5401 * @arg @ref LL_ADC_OVS_RATIO_32
Kojto 122:f9eeca106725 5402 * @arg @ref LL_ADC_OVS_RATIO_64
Kojto 122:f9eeca106725 5403 * @arg @ref LL_ADC_OVS_RATIO_128
Kojto 122:f9eeca106725 5404 * @arg @ref LL_ADC_OVS_RATIO_256
Kojto 122:f9eeca106725 5405 */
Kojto 122:f9eeca106725 5406 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5407 {
Kojto 122:f9eeca106725 5408 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSR));
Kojto 122:f9eeca106725 5409 }
Kojto 122:f9eeca106725 5410
Kojto 122:f9eeca106725 5411 /**
Kojto 122:f9eeca106725 5412 * @brief Get ADC oversampling shift
Kojto 122:f9eeca106725 5413 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5414 * @rmtoll CFGR2 OVSS LL_ADC_GetOverSamplingShift
Kojto 122:f9eeca106725 5415 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5416 * @retval Shift This parameter can be one of the following values:
Kojto 122:f9eeca106725 5417 * @arg @ref LL_ADC_OVS_SHIFT_NONE
Kojto 122:f9eeca106725 5418 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
Kojto 122:f9eeca106725 5419 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
Kojto 122:f9eeca106725 5420 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
Kojto 122:f9eeca106725 5421 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
Kojto 122:f9eeca106725 5422 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
Kojto 122:f9eeca106725 5423 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
Kojto 122:f9eeca106725 5424 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
Kojto 122:f9eeca106725 5425 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
Kojto 122:f9eeca106725 5426 */
Kojto 122:f9eeca106725 5427 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5428 {
Kojto 122:f9eeca106725 5429 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSS));
Kojto 122:f9eeca106725 5430 }
Kojto 122:f9eeca106725 5431
Kojto 122:f9eeca106725 5432 /**
Kojto 122:f9eeca106725 5433 * @}
Kojto 122:f9eeca106725 5434 */
Kojto 122:f9eeca106725 5435
Kojto 122:f9eeca106725 5436 /** @defgroup ADC_LL_EF_Configuration_ADC_Multimode Configuration of ADC hierarchical scope: multimode
Kojto 122:f9eeca106725 5437 * @{
Kojto 122:f9eeca106725 5438 */
Kojto 122:f9eeca106725 5439
Kojto 122:f9eeca106725 5440 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 5441 /**
Kojto 122:f9eeca106725 5442 * @brief Set ADC multimode configuration to operate in independent mode
Kojto 122:f9eeca106725 5443 * or multimode (for devices with several ADC instances).
Kojto 122:f9eeca106725 5444 * @note If multimode configuration: the selected ADC instance is
Kojto 122:f9eeca106725 5445 * either master or slave depending on hardware.
Kojto 122:f9eeca106725 5446 * Refer to reference manual.
Kojto 122:f9eeca106725 5447 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5448 * ADC state:
Kojto 122:f9eeca106725 5449 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 5450 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 5451 * ADC instance or by using helper macro
Kojto 122:f9eeca106725 5452 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 5453 * @rmtoll CCR DUAL LL_ADC_SetMultimode
Kojto 122:f9eeca106725 5454 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5455 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5456 * @param Multimode This parameter can be one of the following values:
Kojto 122:f9eeca106725 5457 * @arg @ref LL_ADC_MULTI_INDEPENDENT
Kojto 122:f9eeca106725 5458 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
Kojto 122:f9eeca106725 5459 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
Kojto 122:f9eeca106725 5460 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
Kojto 122:f9eeca106725 5461 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
Kojto 122:f9eeca106725 5462 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
Kojto 122:f9eeca106725 5463 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
Kojto 122:f9eeca106725 5464 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
Kojto 122:f9eeca106725 5465 * @retval None
Kojto 122:f9eeca106725 5466 */
Kojto 122:f9eeca106725 5467 __STATIC_INLINE void LL_ADC_SetMultimode(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t Multimode)
Kojto 122:f9eeca106725 5468 {
Kojto 122:f9eeca106725 5469 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DUAL, Multimode);
Kojto 122:f9eeca106725 5470 }
Kojto 122:f9eeca106725 5471
Kojto 122:f9eeca106725 5472 /**
Kojto 122:f9eeca106725 5473 * @brief Get ADC multimode configuration to operate in independent mode
Kojto 122:f9eeca106725 5474 * or multimode (for devices with several ADC instances).
Kojto 122:f9eeca106725 5475 * @note If multimode configuration: the selected ADC instance is
Kojto 122:f9eeca106725 5476 * either master or slave depending on hardware.
Kojto 122:f9eeca106725 5477 * Refer to reference manual.
Kojto 122:f9eeca106725 5478 * @rmtoll CCR DUAL LL_ADC_GetMultimode
Kojto 122:f9eeca106725 5479 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5480 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5481 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5482 * @arg @ref LL_ADC_MULTI_INDEPENDENT
Kojto 122:f9eeca106725 5483 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
Kojto 122:f9eeca106725 5484 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
Kojto 122:f9eeca106725 5485 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
Kojto 122:f9eeca106725 5486 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
Kojto 122:f9eeca106725 5487 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
Kojto 122:f9eeca106725 5488 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
Kojto 122:f9eeca106725 5489 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
Kojto 122:f9eeca106725 5490 */
Kojto 122:f9eeca106725 5491 __STATIC_INLINE uint32_t LL_ADC_GetMultimode(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5492 {
Kojto 122:f9eeca106725 5493 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DUAL));
Kojto 122:f9eeca106725 5494 }
Kojto 122:f9eeca106725 5495
Kojto 122:f9eeca106725 5496 /**
Kojto 122:f9eeca106725 5497 * @brief Set ADC multimode conversion data transfer: no transfer
Kojto 122:f9eeca106725 5498 * or transfer by DMA.
Kojto 122:f9eeca106725 5499 * @note If ADC multimode transfer by DMA is not selected:
Kojto 122:f9eeca106725 5500 * each ADC uses its own DMA channel, with its individual
Kojto 122:f9eeca106725 5501 * DMA transfer settings.
Kojto 122:f9eeca106725 5502 * If ADC multimode transfer by DMA is selected:
Kojto 122:f9eeca106725 5503 * One DMA channel is used for both ADC (DMA of ADC master)
Kojto 122:f9eeca106725 5504 * Specifies the DMA requests mode:
Kojto 122:f9eeca106725 5505 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 5506 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 5507 * ADC conversions) is reached.
Kojto 122:f9eeca106725 5508 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 5509 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 5510 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 5511 * ADC conversions).
Kojto 122:f9eeca106725 5512 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 5513 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 5514 * mode non-circular:
Kojto 122:f9eeca106725 5515 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 5516 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 5517 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 5518 * @note How to retrieve multimode conversion data:
Kojto 122:f9eeca106725 5519 * Whatever multimode transfer by DMA setting: using function
Kojto 122:f9eeca106725 5520 * @ref LL_ADC_REG_ReadMultiConversionData32().
Kojto 122:f9eeca106725 5521 * If ADC multimode transfer by DMA is selected: conversion data
Kojto 122:f9eeca106725 5522 * is a raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 5523 * A macro is available to get the conversion data of
Kojto 122:f9eeca106725 5524 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 5525 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 5526 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5527 * ADC state:
Kojto 122:f9eeca106725 5528 * All ADC instances of the ADC common group must be disabled
Kojto 122:f9eeca106725 5529 * or enabled without conversion on going on group regular.
Kojto 122:f9eeca106725 5530 * @rmtoll CCR MDMA LL_ADC_SetMultiDMATransfer\n
Kojto 122:f9eeca106725 5531 * CCR DMACFG LL_ADC_SetMultiDMATransfer
Kojto 122:f9eeca106725 5532 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5533 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5534 * @param MultiDMATransfer This parameter can be one of the following values:
Kojto 122:f9eeca106725 5535 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
Kojto 122:f9eeca106725 5536 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES12_10B
Kojto 122:f9eeca106725 5537 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES8_6B
Kojto 122:f9eeca106725 5538 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES12_10B
Kojto 122:f9eeca106725 5539 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES8_6B
Kojto 122:f9eeca106725 5540 * @retval None
Kojto 122:f9eeca106725 5541 */
Kojto 122:f9eeca106725 5542 __STATIC_INLINE void LL_ADC_SetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiDMATransfer)
Kojto 122:f9eeca106725 5543 {
Kojto 122:f9eeca106725 5544 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_MDMA | ADC_CCR_DMACFG, MultiDMATransfer);
Kojto 122:f9eeca106725 5545 }
Kojto 122:f9eeca106725 5546
Kojto 122:f9eeca106725 5547 /**
Kojto 122:f9eeca106725 5548 * @brief Get ADC multimode conversion data transfer: no transfer
Kojto 122:f9eeca106725 5549 * or transfer by DMA.
Kojto 122:f9eeca106725 5550 * @note If ADC multimode transfer by DMA is not selected:
Kojto 122:f9eeca106725 5551 * each ADC uses its own DMA channel, with its individual
Kojto 122:f9eeca106725 5552 * DMA transfer settings.
Kojto 122:f9eeca106725 5553 * If ADC multimode transfer by DMA is selected:
Kojto 122:f9eeca106725 5554 * One DMA channel is used for both ADC (DMA of ADC master)
Kojto 122:f9eeca106725 5555 * Specifies the DMA requests mode:
Kojto 122:f9eeca106725 5556 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 5557 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 5558 * ADC conversions) is reached.
Kojto 122:f9eeca106725 5559 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 5560 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 5561 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 5562 * ADC conversions).
Kojto 122:f9eeca106725 5563 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 5564 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 5565 * mode non-circular:
Kojto 122:f9eeca106725 5566 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 5567 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 5568 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 5569 * @note How to retrieve multimode conversion data:
Kojto 122:f9eeca106725 5570 * Whatever multimode transfer by DMA setting: using function
Kojto 122:f9eeca106725 5571 * @ref LL_ADC_REG_ReadMultiConversionData32().
Kojto 122:f9eeca106725 5572 * If ADC multimode transfer by DMA is selected: conversion data
Kojto 122:f9eeca106725 5573 * is a raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 5574 * A macro is available to get the conversion data of
Kojto 122:f9eeca106725 5575 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 5576 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 5577 * @rmtoll CCR MDMA LL_ADC_GetMultiDMATransfer\n
Kojto 122:f9eeca106725 5578 * CCR DMACFG LL_ADC_GetMultiDMATransfer
Kojto 122:f9eeca106725 5579 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5580 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5581 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5582 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
Kojto 122:f9eeca106725 5583 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES12_10B
Kojto 122:f9eeca106725 5584 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES8_6B
Kojto 122:f9eeca106725 5585 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES12_10B
Kojto 122:f9eeca106725 5586 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES8_6B
Kojto 122:f9eeca106725 5587 */
Kojto 122:f9eeca106725 5588 __STATIC_INLINE uint32_t LL_ADC_GetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5589 {
Kojto 122:f9eeca106725 5590 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_MDMA | ADC_CCR_DMACFG));
Kojto 122:f9eeca106725 5591 }
Kojto 122:f9eeca106725 5592
Kojto 122:f9eeca106725 5593 /**
Kojto 122:f9eeca106725 5594 * @brief Set ADC multimode delay between 2 sampling phases.
Kojto 122:f9eeca106725 5595 * @note The sampling delay range depends on ADC resolution:
Kojto 122:f9eeca106725 5596 * - ADC resolution 12 bits can have maximum delay of 12 cycles.
Kojto 122:f9eeca106725 5597 * - ADC resolution 10 bits can have maximum delay of 10 cycles.
Kojto 122:f9eeca106725 5598 * - ADC resolution 8 bits can have maximum delay of 8 cycles.
Kojto 122:f9eeca106725 5599 * - ADC resolution 6 bits can have maximum delay of 6 cycles.
Kojto 122:f9eeca106725 5600 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5601 * ADC state:
Kojto 122:f9eeca106725 5602 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 5603 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 5604 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 5605 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 5606 * @rmtoll CCR DELAY LL_ADC_SetMultiTwoSamplingDelay
Kojto 122:f9eeca106725 5607 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5608 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5609 * @param MultiTwoSamplingDelay This parameter can be one of the following values:
Kojto 122:f9eeca106725 5610 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE
Kojto 122:f9eeca106725 5611 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES
Kojto 122:f9eeca106725 5612 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES
Kojto 122:f9eeca106725 5613 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES
Kojto 122:f9eeca106725 5614 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
Kojto 122:f9eeca106725 5615 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES (1)
Kojto 122:f9eeca106725 5616 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES (1)
Kojto 122:f9eeca106725 5617 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES (2)
Kojto 122:f9eeca106725 5618 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES (2)
Kojto 122:f9eeca106725 5619 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES (2)
Kojto 122:f9eeca106725 5620 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES (3)
Kojto 122:f9eeca106725 5621 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES (3)
Kojto 122:f9eeca106725 5622 *
Kojto 122:f9eeca106725 5623 * (1) Parameter available only if ADC resolution is 12, 10 or 8 bits.\n
Kojto 122:f9eeca106725 5624 * (2) Parameter available only if ADC resolution is 12 or 10 bits.\n
Kojto 122:f9eeca106725 5625 * (3) Parameter available only if ADC resolution is 12 bits.
Kojto 122:f9eeca106725 5626 * @retval None
Kojto 122:f9eeca106725 5627 */
Kojto 122:f9eeca106725 5628 __STATIC_INLINE void LL_ADC_SetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiTwoSamplingDelay)
Kojto 122:f9eeca106725 5629 {
Kojto 122:f9eeca106725 5630 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DELAY, MultiTwoSamplingDelay);
Kojto 122:f9eeca106725 5631 }
Kojto 122:f9eeca106725 5632
Kojto 122:f9eeca106725 5633 /**
Kojto 122:f9eeca106725 5634 * @brief Get ADC multimode delay between 2 sampling phases.
Kojto 122:f9eeca106725 5635 * @rmtoll CCR DELAY LL_ADC_GetMultiTwoSamplingDelay
Kojto 122:f9eeca106725 5636 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5637 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5638 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5639 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE
Kojto 122:f9eeca106725 5640 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES
Kojto 122:f9eeca106725 5641 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES
Kojto 122:f9eeca106725 5642 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES
Kojto 122:f9eeca106725 5643 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
Kojto 122:f9eeca106725 5644 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES (1)
Kojto 122:f9eeca106725 5645 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES (1)
Kojto 122:f9eeca106725 5646 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES (2)
Kojto 122:f9eeca106725 5647 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES (2)
Kojto 122:f9eeca106725 5648 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES (2)
Kojto 122:f9eeca106725 5649 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES (3)
Kojto 122:f9eeca106725 5650 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES (3)
Kojto 122:f9eeca106725 5651 *
Kojto 122:f9eeca106725 5652 * (1) Parameter available only if ADC resolution is 12, 10 or 8 bits.\n
Kojto 122:f9eeca106725 5653 * (2) Parameter available only if ADC resolution is 12 or 10 bits.\n
Kojto 122:f9eeca106725 5654 * (3) Parameter available only if ADC resolution is 12 bits.
Kojto 122:f9eeca106725 5655 */
Kojto 122:f9eeca106725 5656 __STATIC_INLINE uint32_t LL_ADC_GetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5657 {
Kojto 122:f9eeca106725 5658 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DELAY));
Kojto 122:f9eeca106725 5659 }
Kojto 122:f9eeca106725 5660 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 5661
Kojto 122:f9eeca106725 5662 /**
Kojto 122:f9eeca106725 5663 * @}
Kojto 122:f9eeca106725 5664 */
Kojto 122:f9eeca106725 5665 /** @defgroup ADC_LL_EF_Configuration_Leg_Functions Configuration of ADC alternate functions name
Kojto 122:f9eeca106725 5666 * @{
Kojto 122:f9eeca106725 5667 */
Kojto 122:f9eeca106725 5668 /* Old functions name kept for legacy purpose, to be replaced by the */
Kojto 122:f9eeca106725 5669 /* current functions name. */
Kojto 122:f9eeca106725 5670 __STATIC_INLINE void LL_ADC_REG_SetTrigSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 5671 {
Kojto 122:f9eeca106725 5672 LL_ADC_REG_SetTrigSource(ADCx, TriggerSource);
Kojto 122:f9eeca106725 5673 }
Kojto 122:f9eeca106725 5674 __STATIC_INLINE void LL_ADC_INJ_SetTrigSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 5675 {
Kojto 122:f9eeca106725 5676 LL_ADC_INJ_SetTrigSource(ADCx, TriggerSource);
Kojto 122:f9eeca106725 5677 }
Kojto 122:f9eeca106725 5678
Kojto 122:f9eeca106725 5679 /**
Kojto 122:f9eeca106725 5680 * @}
Kojto 122:f9eeca106725 5681 */
Kojto 122:f9eeca106725 5682
Kojto 122:f9eeca106725 5683 /** @defgroup ADC_LL_EF_Operation_ADC_Instance Operation on ADC hierarchical scope: ADC instance
Kojto 122:f9eeca106725 5684 * @{
Kojto 122:f9eeca106725 5685 */
Kojto 122:f9eeca106725 5686
Kojto 122:f9eeca106725 5687 /**
Kojto 122:f9eeca106725 5688 * @brief Put ADC instance in deep power down state.
Kojto 122:f9eeca106725 5689 * @note In case of ADC calibration necessary: When ADC is in deep-power-down
Kojto 122:f9eeca106725 5690 * state, the internal analog calibration is lost. After exiting from
Kojto 122:f9eeca106725 5691 * deep power down, calibration must be relaunched or calibration factor
Kojto 122:f9eeca106725 5692 * (preliminarily saved) must be set back into calibration register.
Kojto 122:f9eeca106725 5693 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5694 * ADC state:
Kojto 122:f9eeca106725 5695 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5696 * @rmtoll CR DEEPPWD LL_ADC_EnableDeepPowerDown
Kojto 122:f9eeca106725 5697 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5698 * @retval None
Kojto 122:f9eeca106725 5699 */
Kojto 122:f9eeca106725 5700 __STATIC_INLINE void LL_ADC_EnableDeepPowerDown(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5701 {
Kojto 122:f9eeca106725 5702 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5703 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5704 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5705 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5706 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5707 ADC_CR_DEEPPWD);
Kojto 122:f9eeca106725 5708 }
Kojto 122:f9eeca106725 5709
Kojto 122:f9eeca106725 5710 /**
Kojto 122:f9eeca106725 5711 * @brief Disable ADC deep power down mode.
Kojto 122:f9eeca106725 5712 * @note In case of ADC calibration necessary: When ADC is in deep-power-down
Kojto 122:f9eeca106725 5713 * state, the internal analog calibration is lost. After exiting from
Kojto 122:f9eeca106725 5714 * deep power down, calibration must be relaunched or calibration factor
Kojto 122:f9eeca106725 5715 * (preliminarily saved) must be set back into calibration register.
Kojto 122:f9eeca106725 5716 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5717 * ADC state:
Kojto 122:f9eeca106725 5718 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5719 * @rmtoll CR DEEPPWD LL_ADC_DisableDeepPowerDown
Kojto 122:f9eeca106725 5720 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5721 * @retval None
Kojto 122:f9eeca106725 5722 */
Kojto 122:f9eeca106725 5723 __STATIC_INLINE void LL_ADC_DisableDeepPowerDown(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5724 {
Kojto 122:f9eeca106725 5725 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5726 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5727 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5728 CLEAR_BIT(ADCx->CR, (ADC_CR_DEEPPWD | ADC_CR_BITS_PROPERTY_RS));
Kojto 122:f9eeca106725 5729 }
Kojto 122:f9eeca106725 5730
Kojto 122:f9eeca106725 5731 /**
Kojto 122:f9eeca106725 5732 * @brief Get the selected ADC instance deep power down state.
Kojto 122:f9eeca106725 5733 * @rmtoll CR DEEPPWD LL_ADC_IsDeepPowerDownEnabled
Kojto 122:f9eeca106725 5734 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5735 * @retval 0: deep power down is disabled, 1: deep power down is enabled.
Kojto 122:f9eeca106725 5736 */
Kojto 122:f9eeca106725 5737 __STATIC_INLINE uint32_t LL_ADC_IsDeepPowerDownEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5738 {
Kojto 122:f9eeca106725 5739 return (READ_BIT(ADCx->CR, ADC_CR_DEEPPWD) == (ADC_CR_DEEPPWD));
Kojto 122:f9eeca106725 5740 }
Kojto 122:f9eeca106725 5741
Kojto 122:f9eeca106725 5742 /**
Kojto 122:f9eeca106725 5743 * @brief Enable ADC instance internal voltage regulator.
Kojto 122:f9eeca106725 5744 * @note On this STM32 serie, after ADC internal voltage regulator enable,
Kojto 122:f9eeca106725 5745 * a delay for ADC internal voltage regulator stabilization
Kojto 122:f9eeca106725 5746 * is required before performing a ADC calibration or ADC enable.
Kojto 122:f9eeca106725 5747 * Refer to device datasheet, parameter tADCVREG_STUP.
Kojto 122:f9eeca106725 5748 * Refer to literal @ref LL_ADC_DELAY_INTERNAL_REGUL_STAB_US.
Kojto 122:f9eeca106725 5749 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5750 * ADC state:
Kojto 122:f9eeca106725 5751 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5752 * @rmtoll CR ADVREGEN LL_ADC_EnableInternalRegulator
Kojto 122:f9eeca106725 5753 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5754 * @retval None
Kojto 122:f9eeca106725 5755 */
Kojto 122:f9eeca106725 5756 __STATIC_INLINE void LL_ADC_EnableInternalRegulator(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5757 {
Kojto 122:f9eeca106725 5758 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5759 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5760 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5761 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5762 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5763 ADC_CR_ADVREGEN);
Kojto 122:f9eeca106725 5764 }
Kojto 122:f9eeca106725 5765
Kojto 122:f9eeca106725 5766 /**
Kojto 122:f9eeca106725 5767 * @brief Disable ADC internal voltage regulator.
Kojto 122:f9eeca106725 5768 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5769 * ADC state:
Kojto 122:f9eeca106725 5770 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5771 * @rmtoll CR ADVREGEN LL_ADC_DisableInternalRegulator
Kojto 122:f9eeca106725 5772 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5773 * @retval None
Kojto 122:f9eeca106725 5774 */
Kojto 122:f9eeca106725 5775 __STATIC_INLINE void LL_ADC_DisableInternalRegulator(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5776 {
Kojto 122:f9eeca106725 5777 CLEAR_BIT(ADCx->CR, (ADC_CR_ADVREGEN | ADC_CR_BITS_PROPERTY_RS));
Kojto 122:f9eeca106725 5778 }
Kojto 122:f9eeca106725 5779
Kojto 122:f9eeca106725 5780 /**
Kojto 122:f9eeca106725 5781 * @brief Get the selected ADC instance internal voltage regulator state.
Kojto 122:f9eeca106725 5782 * @rmtoll CR ADVREGEN LL_ADC_IsInternalRegulatorEnabled
Kojto 122:f9eeca106725 5783 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5784 * @retval 0: internal regulator is disabled, 1: internal regulator is enabled.
Kojto 122:f9eeca106725 5785 */
Kojto 122:f9eeca106725 5786 __STATIC_INLINE uint32_t LL_ADC_IsInternalRegulatorEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5787 {
Kojto 122:f9eeca106725 5788 return (READ_BIT(ADCx->CR, ADC_CR_ADVREGEN) == (ADC_CR_ADVREGEN));
Kojto 122:f9eeca106725 5789 }
Kojto 122:f9eeca106725 5790
Kojto 122:f9eeca106725 5791 /**
Kojto 122:f9eeca106725 5792 * @brief Enable the selected ADC instance.
Kojto 122:f9eeca106725 5793 * @note On this STM32 serie, after ADC enable, a delay for
Kojto 122:f9eeca106725 5794 * ADC internal analog stabilization is required before performing a
Kojto 122:f9eeca106725 5795 * ADC conversion start.
Kojto 122:f9eeca106725 5796 * Refer to device datasheet, parameter tSTAB.
Kojto 122:f9eeca106725 5797 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 5798 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 5799 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 5800 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5801 * ADC state:
Kojto 122:f9eeca106725 5802 * ADC must be ADC disabled and ADC internal voltage regulator enabled.
Kojto 122:f9eeca106725 5803 * @rmtoll CR ADEN LL_ADC_Enable
Kojto 122:f9eeca106725 5804 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5805 * @retval None
Kojto 122:f9eeca106725 5806 */
Kojto 122:f9eeca106725 5807 __STATIC_INLINE void LL_ADC_Enable(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5808 {
Kojto 122:f9eeca106725 5809 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5810 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5811 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5812 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5813 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5814 ADC_CR_ADEN);
Kojto 122:f9eeca106725 5815 }
Kojto 122:f9eeca106725 5816
Kojto 122:f9eeca106725 5817 /**
Kojto 122:f9eeca106725 5818 * @brief Disable the selected ADC instance.
Kojto 122:f9eeca106725 5819 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5820 * ADC state:
Kojto 122:f9eeca106725 5821 * ADC must be not disabled. Must be enabled without conversion on going
Kojto 122:f9eeca106725 5822 * on either groups regular or injected.
Kojto 122:f9eeca106725 5823 * @rmtoll CR ADDIS LL_ADC_Disable
Kojto 122:f9eeca106725 5824 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5825 * @retval None
Kojto 122:f9eeca106725 5826 */
Kojto 122:f9eeca106725 5827 __STATIC_INLINE void LL_ADC_Disable(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5828 {
Kojto 122:f9eeca106725 5829 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5830 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5831 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5832 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5833 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5834 ADC_CR_ADDIS);
Kojto 122:f9eeca106725 5835 }
Kojto 122:f9eeca106725 5836
Kojto 122:f9eeca106725 5837 /**
Kojto 122:f9eeca106725 5838 * @brief Get the selected ADC instance enable state.
Kojto 122:f9eeca106725 5839 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 5840 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 5841 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 5842 * @rmtoll CR ADEN LL_ADC_IsEnabled
Kojto 122:f9eeca106725 5843 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5844 * @retval 0: ADC is disabled, 1: ADC is enabled.
Kojto 122:f9eeca106725 5845 */
Kojto 122:f9eeca106725 5846 __STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5847 {
Kojto 122:f9eeca106725 5848 return (READ_BIT(ADCx->CR, ADC_CR_ADEN) == (ADC_CR_ADEN));
Kojto 122:f9eeca106725 5849 }
Kojto 122:f9eeca106725 5850
Kojto 122:f9eeca106725 5851 /**
Kojto 122:f9eeca106725 5852 * @brief Get the selected ADC instance disable state.
Kojto 122:f9eeca106725 5853 * @rmtoll CR ADDIS LL_ADC_IsDisableOngoing
Kojto 122:f9eeca106725 5854 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5855 * @retval 0: no ADC disable command on going.
Kojto 122:f9eeca106725 5856 */
Kojto 122:f9eeca106725 5857 __STATIC_INLINE uint32_t LL_ADC_IsDisableOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5858 {
Kojto 122:f9eeca106725 5859 return (READ_BIT(ADCx->CR, ADC_CR_ADDIS) == (ADC_CR_ADDIS));
Kojto 122:f9eeca106725 5860 }
Kojto 122:f9eeca106725 5861
Kojto 122:f9eeca106725 5862 /**
Kojto 122:f9eeca106725 5863 * @brief Start ADC calibration in the mode single-ended
Kojto 122:f9eeca106725 5864 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 5865 * @note On this STM32 serie, a minimum number of ADC clock cycles
Kojto 122:f9eeca106725 5866 * are required between ADC end of calibration and ADC enable.
Kojto 122:f9eeca106725 5867 * Refer to literal @ref LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES.
Kojto 122:f9eeca106725 5868 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 5869 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 5870 * single-ended and differential modes
Kojto 122:f9eeca106725 5871 * (calibration run must be performed for each of these
Kojto 122:f9eeca106725 5872 * differential modes, if used afterwards and if the application
Kojto 122:f9eeca106725 5873 * requires their calibration).
Kojto 122:f9eeca106725 5874 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5875 * ADC state:
Kojto 122:f9eeca106725 5876 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5877 * @rmtoll CR ADCAL LL_ADC_StartCalibration\n
Kojto 122:f9eeca106725 5878 * CR ADCALDIF LL_ADC_StartCalibration
Kojto 122:f9eeca106725 5879 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5880 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 5881 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 5882 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 5883 * @retval None
Kojto 122:f9eeca106725 5884 */
Kojto 122:f9eeca106725 5885 __STATIC_INLINE void LL_ADC_StartCalibration(ADC_TypeDef *ADCx, uint32_t SingleDiff)
Kojto 122:f9eeca106725 5886 {
Kojto 122:f9eeca106725 5887 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5888 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5889 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5890 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5891 ADC_CR_ADCALDIF | ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5892 ADC_CR_ADCAL | (SingleDiff & ADC_SINGLEDIFF_CALIB_START_MASK));
Kojto 122:f9eeca106725 5893 }
Kojto 122:f9eeca106725 5894
Kojto 122:f9eeca106725 5895 /**
Kojto 122:f9eeca106725 5896 * @brief Get ADC calibration state.
Kojto 122:f9eeca106725 5897 * @rmtoll CR ADCAL LL_ADC_IsCalibrationOnGoing
Kojto 122:f9eeca106725 5898 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5899 * @retval 0: calibration complete, 1: calibration in progress.
Kojto 122:f9eeca106725 5900 */
Kojto 122:f9eeca106725 5901 __STATIC_INLINE uint32_t LL_ADC_IsCalibrationOnGoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5902 {
Kojto 122:f9eeca106725 5903 return (READ_BIT(ADCx->CR, ADC_CR_ADCAL) == (ADC_CR_ADCAL));
Kojto 122:f9eeca106725 5904 }
Kojto 122:f9eeca106725 5905
Kojto 122:f9eeca106725 5906 /**
Kojto 122:f9eeca106725 5907 * @}
Kojto 122:f9eeca106725 5908 */
Kojto 122:f9eeca106725 5909
Kojto 122:f9eeca106725 5910 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Regular Operation on ADC hierarchical scope: group regular
Kojto 122:f9eeca106725 5911 * @{
Kojto 122:f9eeca106725 5912 */
Kojto 122:f9eeca106725 5913
Kojto 122:f9eeca106725 5914 /**
Kojto 122:f9eeca106725 5915 * @brief Start ADC group regular conversion.
Kojto 122:f9eeca106725 5916 * @note On this STM32 serie, this function is relevant for both
Kojto 122:f9eeca106725 5917 * internal trigger (SW start) and external trigger:
Kojto 122:f9eeca106725 5918 * - If ADC trigger has been set to software start, ADC conversion
Kojto 122:f9eeca106725 5919 * starts immediately.
Kojto 122:f9eeca106725 5920 * - If ADC trigger has been set to external trigger, ADC conversion
Kojto 122:f9eeca106725 5921 * will start at next trigger event (on the selected trigger edge)
Kojto 122:f9eeca106725 5922 * following the ADC start conversion command.
Kojto 122:f9eeca106725 5923 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5924 * ADC state:
Kojto 122:f9eeca106725 5925 * ADC must be enabled without conversion on going on group regular,
Kojto 122:f9eeca106725 5926 * without conversion stop command on going on group regular.
Kojto 122:f9eeca106725 5927 * @rmtoll CR ADSTART LL_ADC_REG_StartConversion
Kojto 122:f9eeca106725 5928 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5929 * @retval None
Kojto 122:f9eeca106725 5930 */
Kojto 122:f9eeca106725 5931 __STATIC_INLINE void LL_ADC_REG_StartConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5932 {
Kojto 122:f9eeca106725 5933 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5934 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5935 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5936 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5937 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5938 ADC_CR_ADSTART);
Kojto 122:f9eeca106725 5939 }
Kojto 122:f9eeca106725 5940
Kojto 122:f9eeca106725 5941 /**
Kojto 122:f9eeca106725 5942 * @brief Stop ADC group regular conversion.
Kojto 122:f9eeca106725 5943 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5944 * ADC state:
Kojto 122:f9eeca106725 5945 * ADC must be enabled with conversion on going on group regular,
Kojto 122:f9eeca106725 5946 * without ADC disable command on going.
Kojto 122:f9eeca106725 5947 * @rmtoll CR ADSTP LL_ADC_REG_StopConversion
Kojto 122:f9eeca106725 5948 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5949 * @retval None
Kojto 122:f9eeca106725 5950 */
Kojto 122:f9eeca106725 5951 __STATIC_INLINE void LL_ADC_REG_StopConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5952 {
Kojto 122:f9eeca106725 5953 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5954 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5955 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5956 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5957 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5958 ADC_CR_ADSTP);
Kojto 122:f9eeca106725 5959 }
Kojto 122:f9eeca106725 5960
Kojto 122:f9eeca106725 5961 /**
Kojto 122:f9eeca106725 5962 * @brief Get ADC group regular conversion state.
Kojto 122:f9eeca106725 5963 * @rmtoll CR ADSTART LL_ADC_REG_IsConversionOngoing
Kojto 122:f9eeca106725 5964 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5965 * @retval 0: no conversion is on going on ADC group regular.
Kojto 122:f9eeca106725 5966 */
Kojto 122:f9eeca106725 5967 __STATIC_INLINE uint32_t LL_ADC_REG_IsConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5968 {
Kojto 122:f9eeca106725 5969 return (READ_BIT(ADCx->CR, ADC_CR_ADSTART) == (ADC_CR_ADSTART));
Kojto 122:f9eeca106725 5970 }
Kojto 122:f9eeca106725 5971
Kojto 122:f9eeca106725 5972 /**
Kojto 122:f9eeca106725 5973 * @brief Get ADC group regular command of conversion stop state
Kojto 122:f9eeca106725 5974 * @rmtoll CR ADSTP LL_ADC_REG_IsStopConversionOngoing
Kojto 122:f9eeca106725 5975 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5976 * @retval 0: no command of conversion stop is on going on ADC group regular.
Kojto 122:f9eeca106725 5977 */
Kojto 122:f9eeca106725 5978 __STATIC_INLINE uint32_t LL_ADC_REG_IsStopConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5979 {
Kojto 122:f9eeca106725 5980 return (READ_BIT(ADCx->CR, ADC_CR_ADSTP) == (ADC_CR_ADSTP));
Kojto 122:f9eeca106725 5981 }
Kojto 122:f9eeca106725 5982
Kojto 122:f9eeca106725 5983 /**
Kojto 122:f9eeca106725 5984 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 5985 * all ADC configurations: all ADC resolutions and
Kojto 122:f9eeca106725 5986 * all oversampling increased data width (for devices
Kojto 122:f9eeca106725 5987 * with feature oversampling).
Kojto 122:f9eeca106725 5988 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData32
Kojto 122:f9eeca106725 5989 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5990 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 5991 */
Kojto 122:f9eeca106725 5992 __STATIC_INLINE uint32_t LL_ADC_REG_ReadConversionData32(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5993 {
Kojto 122:f9eeca106725 5994 return (uint32_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 5995 }
Kojto 122:f9eeca106725 5996
Kojto 122:f9eeca106725 5997 /**
Kojto 122:f9eeca106725 5998 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 5999 * ADC resolution 12 bits.
Kojto 122:f9eeca106725 6000 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6001 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6002 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6003 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData12
Kojto 122:f9eeca106725 6004 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6005 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 6006 */
Kojto 122:f9eeca106725 6007 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6008 {
Kojto 122:f9eeca106725 6009 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6010 }
Kojto 122:f9eeca106725 6011
Kojto 122:f9eeca106725 6012 /**
Kojto 122:f9eeca106725 6013 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6014 * ADC resolution 10 bits.
Kojto 122:f9eeca106725 6015 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6016 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6017 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6018 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData10
Kojto 122:f9eeca106725 6019 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6020 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 6021 */
Kojto 122:f9eeca106725 6022 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData10(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6023 {
Kojto 122:f9eeca106725 6024 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6025 }
Kojto 122:f9eeca106725 6026
Kojto 122:f9eeca106725 6027 /**
Kojto 122:f9eeca106725 6028 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6029 * ADC resolution 8 bits.
Kojto 122:f9eeca106725 6030 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6031 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6032 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6033 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData8
Kojto 122:f9eeca106725 6034 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6035 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 6036 */
Kojto 122:f9eeca106725 6037 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData8(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6038 {
Kojto 122:f9eeca106725 6039 return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6040 }
Kojto 122:f9eeca106725 6041
Kojto 122:f9eeca106725 6042 /**
Kojto 122:f9eeca106725 6043 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6044 * ADC resolution 6 bits.
Kojto 122:f9eeca106725 6045 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6046 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6047 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6048 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData6
Kojto 122:f9eeca106725 6049 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6050 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
Kojto 122:f9eeca106725 6051 */
Kojto 122:f9eeca106725 6052 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData6(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6053 {
Kojto 122:f9eeca106725 6054 return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6055 }
Kojto 122:f9eeca106725 6056
Kojto 122:f9eeca106725 6057 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 6058 /**
Kojto 122:f9eeca106725 6059 * @brief Get ADC multimode conversion data of ADC master, ADC slave
Kojto 122:f9eeca106725 6060 * or raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 6061 * @note If raw data with ADC master and slave concatenated is retrieved,
Kojto 122:f9eeca106725 6062 * a macro is available to get the conversion data of
Kojto 122:f9eeca106725 6063 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 6064 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 6065 * (however this macro is mainly intended for multimode
Kojto 122:f9eeca106725 6066 * transfer by DMA, because this function can do the same
Kojto 122:f9eeca106725 6067 * by getting multimode conversion data of ADC master or ADC slave
Kojto 122:f9eeca106725 6068 * separately).
Kojto 122:f9eeca106725 6069 * @rmtoll CDR RDATA_MST LL_ADC_REG_ReadMultiConversionData32\n
Kojto 122:f9eeca106725 6070 * CDR RDATA_SLV LL_ADC_REG_ReadMultiConversionData32
Kojto 122:f9eeca106725 6071 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6072 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6073 * @param ConversionData This parameter can be one of the following values:
Kojto 122:f9eeca106725 6074 * @arg @ref LL_ADC_MULTI_MASTER
Kojto 122:f9eeca106725 6075 * @arg @ref LL_ADC_MULTI_SLAVE
Kojto 122:f9eeca106725 6076 * @arg @ref LL_ADC_MULTI_MASTER_SLAVE
Kojto 122:f9eeca106725 6077 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 6078 */
Kojto 122:f9eeca106725 6079 __STATIC_INLINE uint32_t LL_ADC_REG_ReadMultiConversionData32(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t ConversionData)
Kojto 122:f9eeca106725 6080 {
Kojto 122:f9eeca106725 6081 return (uint32_t)(READ_BIT(ADCxy_COMMON->CDR,
Kojto 122:f9eeca106725 6082 ConversionData)
Kojto 122:f9eeca106725 6083 >> POSITION_VAL(ConversionData)
Kojto 122:f9eeca106725 6084 );
Kojto 122:f9eeca106725 6085 }
Kojto 122:f9eeca106725 6086 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 6087
Kojto 122:f9eeca106725 6088 /**
Kojto 122:f9eeca106725 6089 * @}
Kojto 122:f9eeca106725 6090 */
Kojto 122:f9eeca106725 6091
Kojto 122:f9eeca106725 6092 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Injected Operation on ADC hierarchical scope: group injected
Kojto 122:f9eeca106725 6093 * @{
Kojto 122:f9eeca106725 6094 */
Kojto 122:f9eeca106725 6095
Kojto 122:f9eeca106725 6096 /**
Kojto 122:f9eeca106725 6097 * @brief Start ADC group injected conversion.
Kojto 122:f9eeca106725 6098 * @note On this STM32 serie, this function is relevant for both
Kojto 122:f9eeca106725 6099 * internal trigger (SW start) and external trigger:
Kojto 122:f9eeca106725 6100 * - If ADC trigger has been set to software start, ADC conversion
Kojto 122:f9eeca106725 6101 * starts immediately.
Kojto 122:f9eeca106725 6102 * - If ADC trigger has been set to external trigger, ADC conversion
Kojto 122:f9eeca106725 6103 * will start at next trigger event (on the selected trigger edge)
Kojto 122:f9eeca106725 6104 * following the ADC start conversion command.
Kojto 122:f9eeca106725 6105 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6106 * ADC state:
Kojto 122:f9eeca106725 6107 * ADC must be enabled without conversion on going on group injected,
Kojto 122:f9eeca106725 6108 * without conversion stop command on going on group injected.
Kojto 122:f9eeca106725 6109 * @rmtoll CR JADSTART LL_ADC_INJ_StartConversion
Kojto 122:f9eeca106725 6110 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6111 * @retval None
Kojto 122:f9eeca106725 6112 */
Kojto 122:f9eeca106725 6113 __STATIC_INLINE void LL_ADC_INJ_StartConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6114 {
Kojto 122:f9eeca106725 6115 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6116 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6117 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6118 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6119 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6120 ADC_CR_JADSTART);
Kojto 122:f9eeca106725 6121 }
Kojto 122:f9eeca106725 6122
Kojto 122:f9eeca106725 6123 /**
Kojto 122:f9eeca106725 6124 * @brief Stop ADC group injected conversion.
Kojto 122:f9eeca106725 6125 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6126 * ADC state:
Kojto 122:f9eeca106725 6127 * ADC must be enabled with conversion on going on group injected,
Kojto 122:f9eeca106725 6128 * without ADC disable command on going.
Kojto 122:f9eeca106725 6129 * @rmtoll CR JADSTP LL_ADC_INJ_StopConversion
Kojto 122:f9eeca106725 6130 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6131 * @retval None
Kojto 122:f9eeca106725 6132 */
Kojto 122:f9eeca106725 6133 __STATIC_INLINE void LL_ADC_INJ_StopConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6134 {
Kojto 122:f9eeca106725 6135 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6136 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6137 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6138 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6139 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6140 ADC_CR_JADSTP);
Kojto 122:f9eeca106725 6141 }
Kojto 122:f9eeca106725 6142
Kojto 122:f9eeca106725 6143 /**
Kojto 122:f9eeca106725 6144 * @brief Get ADC group injected conversion state.
Kojto 122:f9eeca106725 6145 * @rmtoll CR JADSTART LL_ADC_INJ_IsConversionOngoing
Kojto 122:f9eeca106725 6146 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6147 * @retval 0: no conversion is on going on ADC group injected.
Kojto 122:f9eeca106725 6148 */
Kojto 122:f9eeca106725 6149 __STATIC_INLINE uint32_t LL_ADC_INJ_IsConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6150 {
Kojto 122:f9eeca106725 6151 return (READ_BIT(ADCx->CR, ADC_CR_JADSTART) == (ADC_CR_JADSTART));
Kojto 122:f9eeca106725 6152 }
Kojto 122:f9eeca106725 6153
Kojto 122:f9eeca106725 6154 /**
Kojto 122:f9eeca106725 6155 * @brief Get ADC group injected command of conversion stop state
Kojto 122:f9eeca106725 6156 * @rmtoll CR JADSTP LL_ADC_INJ_IsStopConversionOngoing
Kojto 122:f9eeca106725 6157 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6158 * @retval 0: no command of conversion stop is on going on ADC group injected.
Kojto 122:f9eeca106725 6159 */
Kojto 122:f9eeca106725 6160 __STATIC_INLINE uint32_t LL_ADC_INJ_IsStopConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6161 {
Kojto 122:f9eeca106725 6162 return (READ_BIT(ADCx->CR, ADC_CR_JADSTP) == (ADC_CR_JADSTP));
Kojto 122:f9eeca106725 6163 }
Kojto 122:f9eeca106725 6164
Kojto 122:f9eeca106725 6165 /**
Kojto 122:f9eeca106725 6166 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6167 * all ADC configurations: all ADC resolutions and
Kojto 122:f9eeca106725 6168 * all oversampling increased data width (for devices
Kojto 122:f9eeca106725 6169 * with feature oversampling).
Kojto 122:f9eeca106725 6170 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6171 * JDR2 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6172 * JDR3 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6173 * JDR4 JDATA LL_ADC_INJ_ReadConversionData32
Kojto 122:f9eeca106725 6174 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6175 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6176 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6177 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6178 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6179 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6180 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 6181 */
Kojto 122:f9eeca106725 6182 __STATIC_INLINE uint32_t LL_ADC_INJ_ReadConversionData32(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6183 {
Kojto 122:f9eeca106725 6184 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6185
Kojto 122:f9eeca106725 6186 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6187 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6188 );
Kojto 122:f9eeca106725 6189 }
Kojto 122:f9eeca106725 6190
Kojto 122:f9eeca106725 6191 /**
Kojto 122:f9eeca106725 6192 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6193 * ADC resolution 12 bits.
Kojto 122:f9eeca106725 6194 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6195 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6196 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6197 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6198 * JDR2 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6199 * JDR3 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6200 * JDR4 JDATA LL_ADC_INJ_ReadConversionData12
Kojto 122:f9eeca106725 6201 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6202 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6203 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6204 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6205 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6206 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6207 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 6208 */
Kojto 122:f9eeca106725 6209 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData12(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6210 {
Kojto 122:f9eeca106725 6211 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6212
Kojto 122:f9eeca106725 6213 return (uint16_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6214 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6215 );
Kojto 122:f9eeca106725 6216 }
Kojto 122:f9eeca106725 6217
Kojto 122:f9eeca106725 6218 /**
Kojto 122:f9eeca106725 6219 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6220 * ADC resolution 10 bits.
Kojto 122:f9eeca106725 6221 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6222 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6223 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6224 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6225 * JDR2 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6226 * JDR3 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6227 * JDR4 JDATA LL_ADC_INJ_ReadConversionData10
Kojto 122:f9eeca106725 6228 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6229 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6230 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6231 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6232 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6233 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6234 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 6235 */
Kojto 122:f9eeca106725 6236 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData10(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6237 {
Kojto 122:f9eeca106725 6238 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6239
Kojto 122:f9eeca106725 6240 return (uint16_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6241 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6242 );
Kojto 122:f9eeca106725 6243 }
Kojto 122:f9eeca106725 6244
Kojto 122:f9eeca106725 6245 /**
Kojto 122:f9eeca106725 6246 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6247 * ADC resolution 8 bits.
Kojto 122:f9eeca106725 6248 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6249 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6250 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6251 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6252 * JDR2 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6253 * JDR3 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6254 * JDR4 JDATA LL_ADC_INJ_ReadConversionData8
Kojto 122:f9eeca106725 6255 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6256 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6257 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6258 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6259 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6260 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6261 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 6262 */
Kojto 122:f9eeca106725 6263 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData8(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6264 {
Kojto 122:f9eeca106725 6265 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6266
Kojto 122:f9eeca106725 6267 return (uint8_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6268 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6269 );
Kojto 122:f9eeca106725 6270 }
Kojto 122:f9eeca106725 6271
Kojto 122:f9eeca106725 6272 /**
Kojto 122:f9eeca106725 6273 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6274 * ADC resolution 6 bits.
Kojto 122:f9eeca106725 6275 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6276 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6277 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6278 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6279 * JDR2 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6280 * JDR3 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6281 * JDR4 JDATA LL_ADC_INJ_ReadConversionData6
Kojto 122:f9eeca106725 6282 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6283 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6284 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6285 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6286 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6287 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6288 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
Kojto 122:f9eeca106725 6289 */
Kojto 122:f9eeca106725 6290 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData6(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6291 {
Kojto 122:f9eeca106725 6292 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6293
Kojto 122:f9eeca106725 6294 return (uint8_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6295 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6296 );
Kojto 122:f9eeca106725 6297 }
Kojto 122:f9eeca106725 6298
Kojto 122:f9eeca106725 6299 /**
Kojto 122:f9eeca106725 6300 * @}
Kojto 122:f9eeca106725 6301 */
Kojto 122:f9eeca106725 6302
Kojto 122:f9eeca106725 6303 /** @defgroup ADC_LL_EF_FLAG_Management ADC flag management
Kojto 122:f9eeca106725 6304 * @{
Kojto 122:f9eeca106725 6305 */
Kojto 122:f9eeca106725 6306
Kojto 122:f9eeca106725 6307 /**
Kojto 122:f9eeca106725 6308 * @brief Get flag ADC ready.
Kojto 122:f9eeca106725 6309 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 6310 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 6311 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 6312 * @rmtoll ISR ADRDY LL_ADC_IsActiveFlag_ADRDY
Kojto 122:f9eeca106725 6313 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6314 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6315 */
Kojto 122:f9eeca106725 6316 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6317 {
Kojto 122:f9eeca106725 6318 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_ADRDY) == (LL_ADC_FLAG_ADRDY));
Kojto 122:f9eeca106725 6319 }
Kojto 122:f9eeca106725 6320
Kojto 122:f9eeca106725 6321 /**
Kojto 122:f9eeca106725 6322 * @brief Get flag ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6323 * @rmtoll ISR EOC LL_ADC_IsActiveFlag_EOC
Kojto 122:f9eeca106725 6324 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6325 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6326 */
Kojto 122:f9eeca106725 6327 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6328 {
Kojto 122:f9eeca106725 6329 return (READ_BIT(ADCx->ISR, ADC_ISR_EOC) == (ADC_ISR_EOC));
Kojto 122:f9eeca106725 6330 }
Kojto 122:f9eeca106725 6331
Kojto 122:f9eeca106725 6332 /**
Kojto 122:f9eeca106725 6333 * @brief Get flag ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6334 * @rmtoll ISR EOS LL_ADC_IsActiveFlag_EOS
Kojto 122:f9eeca106725 6335 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6336 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6337 */
Kojto 122:f9eeca106725 6338 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6339 {
Kojto 122:f9eeca106725 6340 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOS) == (LL_ADC_FLAG_EOS));
Kojto 122:f9eeca106725 6341 }
Kojto 122:f9eeca106725 6342
Kojto 122:f9eeca106725 6343 /**
Kojto 122:f9eeca106725 6344 * @brief Get flag ADC group regular overrun.
Kojto 122:f9eeca106725 6345 * @rmtoll ISR OVR LL_ADC_IsActiveFlag_OVR
Kojto 122:f9eeca106725 6346 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6347 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6348 */
Kojto 122:f9eeca106725 6349 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6350 {
Kojto 122:f9eeca106725 6351 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_OVR) == (LL_ADC_FLAG_OVR));
Kojto 122:f9eeca106725 6352 }
Kojto 122:f9eeca106725 6353
Kojto 122:f9eeca106725 6354 /**
Kojto 122:f9eeca106725 6355 * @brief Get flag ADC group regular end of sampling phase.
Kojto 122:f9eeca106725 6356 * @rmtoll ISR EOSMP LL_ADC_IsActiveFlag_EOSMP
Kojto 122:f9eeca106725 6357 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6358 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6359 */
Kojto 122:f9eeca106725 6360 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6361 {
Kojto 122:f9eeca106725 6362 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOSMP) == (LL_ADC_FLAG_EOSMP));
Kojto 122:f9eeca106725 6363 }
Kojto 122:f9eeca106725 6364
Kojto 122:f9eeca106725 6365 /**
Kojto 122:f9eeca106725 6366 * @brief Get flag ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6367 * @rmtoll ISR JEOC LL_ADC_IsActiveFlag_JEOC
Kojto 122:f9eeca106725 6368 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6369 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6370 */
Kojto 122:f9eeca106725 6371 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6372 {
Kojto 122:f9eeca106725 6373 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOC) == (LL_ADC_FLAG_JEOC));
Kojto 122:f9eeca106725 6374 }
Kojto 122:f9eeca106725 6375
Kojto 122:f9eeca106725 6376 /**
Kojto 122:f9eeca106725 6377 * @brief Get flag ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 6378 * @rmtoll ISR JEOS LL_ADC_IsActiveFlag_JEOS
Kojto 122:f9eeca106725 6379 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6380 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6381 */
Kojto 122:f9eeca106725 6382 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6383 {
Kojto 122:f9eeca106725 6384 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS));
Kojto 122:f9eeca106725 6385 }
Kojto 122:f9eeca106725 6386
Kojto 122:f9eeca106725 6387 /**
Kojto 122:f9eeca106725 6388 * @brief Get flag ADC group injected contexts queue overflow.
Kojto 122:f9eeca106725 6389 * @rmtoll ISR JQOVF LL_ADC_IsActiveFlag_JQOVF
Kojto 122:f9eeca106725 6390 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6391 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6392 */
Kojto 122:f9eeca106725 6393 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6394 {
Kojto 122:f9eeca106725 6395 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JQOVF) == (LL_ADC_FLAG_JQOVF));
Kojto 122:f9eeca106725 6396 }
Kojto 122:f9eeca106725 6397
Kojto 122:f9eeca106725 6398 /**
Kojto 122:f9eeca106725 6399 * @brief Get flag ADC analog watchdog 1 flag
Kojto 122:f9eeca106725 6400 * @rmtoll ISR AWD1 LL_ADC_IsActiveFlag_AWD1
Kojto 122:f9eeca106725 6401 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6402 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6403 */
Kojto 122:f9eeca106725 6404 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6405 {
Kojto 122:f9eeca106725 6406 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD1) == (LL_ADC_FLAG_AWD1));
Kojto 122:f9eeca106725 6407 }
Kojto 122:f9eeca106725 6408
Kojto 122:f9eeca106725 6409 /**
Kojto 122:f9eeca106725 6410 * @brief Get flag ADC analog watchdog 2.
Kojto 122:f9eeca106725 6411 * @rmtoll ISR AWD2 LL_ADC_IsActiveFlag_AWD2
Kojto 122:f9eeca106725 6412 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6413 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6414 */
Kojto 122:f9eeca106725 6415 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6416 {
Kojto 122:f9eeca106725 6417 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD2) == (LL_ADC_FLAG_AWD2));
Kojto 122:f9eeca106725 6418 }
Kojto 122:f9eeca106725 6419
Kojto 122:f9eeca106725 6420 /**
Kojto 122:f9eeca106725 6421 * @brief Get flag ADC analog watchdog 3.
Kojto 122:f9eeca106725 6422 * @rmtoll ISR AWD3 LL_ADC_IsActiveFlag_AWD3
Kojto 122:f9eeca106725 6423 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6424 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6425 */
Kojto 122:f9eeca106725 6426 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6427 {
Kojto 122:f9eeca106725 6428 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD3) == (LL_ADC_FLAG_AWD3));
Kojto 122:f9eeca106725 6429 }
Kojto 122:f9eeca106725 6430
Kojto 122:f9eeca106725 6431 /**
Kojto 122:f9eeca106725 6432 * @brief Clear flag ADC ready.
Kojto 122:f9eeca106725 6433 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 6434 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 6435 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 6436 * @rmtoll ISR ADRDY LL_ADC_ClearFlag_ADRDY
Kojto 122:f9eeca106725 6437 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6438 * @retval None
Kojto 122:f9eeca106725 6439 */
Kojto 122:f9eeca106725 6440 __STATIC_INLINE void LL_ADC_ClearFlag_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6441 {
Kojto 122:f9eeca106725 6442 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_ADRDY);
Kojto 122:f9eeca106725 6443 }
Kojto 122:f9eeca106725 6444
Kojto 122:f9eeca106725 6445 /**
Kojto 122:f9eeca106725 6446 * @brief Clear flag ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6447 * @rmtoll ISR EOC LL_ADC_ClearFlag_EOC
Kojto 122:f9eeca106725 6448 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6449 * @retval None
Kojto 122:f9eeca106725 6450 */
Kojto 122:f9eeca106725 6451 __STATIC_INLINE void LL_ADC_ClearFlag_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6452 {
Kojto 122:f9eeca106725 6453 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOC);
Kojto 122:f9eeca106725 6454 }
Kojto 122:f9eeca106725 6455
Kojto 122:f9eeca106725 6456 /**
Kojto 122:f9eeca106725 6457 * @brief Clear flag ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6458 * @rmtoll ISR EOS LL_ADC_ClearFlag_EOS
Kojto 122:f9eeca106725 6459 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6460 * @retval None
Kojto 122:f9eeca106725 6461 */
Kojto 122:f9eeca106725 6462 __STATIC_INLINE void LL_ADC_ClearFlag_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6463 {
Kojto 122:f9eeca106725 6464 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOS);
Kojto 122:f9eeca106725 6465 }
Kojto 122:f9eeca106725 6466
Kojto 122:f9eeca106725 6467 /**
Kojto 122:f9eeca106725 6468 * @brief Clear flag ADC group regular overrun.
Kojto 122:f9eeca106725 6469 * @rmtoll ISR OVR LL_ADC_ClearFlag_OVR
Kojto 122:f9eeca106725 6470 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6471 * @retval None
Kojto 122:f9eeca106725 6472 */
Kojto 122:f9eeca106725 6473 __STATIC_INLINE void LL_ADC_ClearFlag_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6474 {
Kojto 122:f9eeca106725 6475 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_OVR);
Kojto 122:f9eeca106725 6476 }
Kojto 122:f9eeca106725 6477
Kojto 122:f9eeca106725 6478 /**
Kojto 122:f9eeca106725 6479 * @brief Clear flag ADC group regular end of sampling phase.
Kojto 122:f9eeca106725 6480 * @rmtoll ISR EOSMP LL_ADC_ClearFlag_EOSMP
Kojto 122:f9eeca106725 6481 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6482 * @retval None
Kojto 122:f9eeca106725 6483 */
Kojto 122:f9eeca106725 6484 __STATIC_INLINE void LL_ADC_ClearFlag_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6485 {
Kojto 122:f9eeca106725 6486 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOSMP);
Kojto 122:f9eeca106725 6487 }
Kojto 122:f9eeca106725 6488
Kojto 122:f9eeca106725 6489 /**
Kojto 122:f9eeca106725 6490 * @brief Clear flag ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6491 * @rmtoll ISR JEOC LL_ADC_ClearFlag_JEOC
Kojto 122:f9eeca106725 6492 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6493 * @retval None
Kojto 122:f9eeca106725 6494 */
Kojto 122:f9eeca106725 6495 __STATIC_INLINE void LL_ADC_ClearFlag_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6496 {
Kojto 122:f9eeca106725 6497 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOC);
Kojto 122:f9eeca106725 6498 }
Kojto 122:f9eeca106725 6499
Kojto 122:f9eeca106725 6500 /**
Kojto 122:f9eeca106725 6501 * @brief Clear flag ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 6502 * @rmtoll ISR JEOS LL_ADC_ClearFlag_JEOS
Kojto 122:f9eeca106725 6503 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6504 * @retval None
Kojto 122:f9eeca106725 6505 */
Kojto 122:f9eeca106725 6506 __STATIC_INLINE void LL_ADC_ClearFlag_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6507 {
Kojto 122:f9eeca106725 6508 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOS);
Kojto 122:f9eeca106725 6509 }
Kojto 122:f9eeca106725 6510
Kojto 122:f9eeca106725 6511 /**
Kojto 122:f9eeca106725 6512 * @brief Clear flag ADC group injected contexts queue overflow.
Kojto 122:f9eeca106725 6513 * @rmtoll ISR JQOVF LL_ADC_ClearFlag_JQOVF
Kojto 122:f9eeca106725 6514 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6515 * @retval None
Kojto 122:f9eeca106725 6516 */
Kojto 122:f9eeca106725 6517 __STATIC_INLINE void LL_ADC_ClearFlag_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6518 {
Kojto 122:f9eeca106725 6519 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JQOVF);
Kojto 122:f9eeca106725 6520 }
Kojto 122:f9eeca106725 6521
Kojto 122:f9eeca106725 6522 /**
Kojto 122:f9eeca106725 6523 * @brief Clear flag ADC analog watchdog 1.
Kojto 122:f9eeca106725 6524 * @rmtoll ISR AWD1 LL_ADC_ClearFlag_AWD1
Kojto 122:f9eeca106725 6525 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6526 * @retval None
Kojto 122:f9eeca106725 6527 */
Kojto 122:f9eeca106725 6528 __STATIC_INLINE void LL_ADC_ClearFlag_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6529 {
Kojto 122:f9eeca106725 6530 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD1);
Kojto 122:f9eeca106725 6531 }
Kojto 122:f9eeca106725 6532
Kojto 122:f9eeca106725 6533 /**
Kojto 122:f9eeca106725 6534 * @brief Clear flag ADC analog watchdog 2.
Kojto 122:f9eeca106725 6535 * @rmtoll ISR AWD2 LL_ADC_ClearFlag_AWD2
Kojto 122:f9eeca106725 6536 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6537 * @retval None
Kojto 122:f9eeca106725 6538 */
Kojto 122:f9eeca106725 6539 __STATIC_INLINE void LL_ADC_ClearFlag_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6540 {
Kojto 122:f9eeca106725 6541 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD2);
Kojto 122:f9eeca106725 6542 }
Kojto 122:f9eeca106725 6543
Kojto 122:f9eeca106725 6544 /**
Kojto 122:f9eeca106725 6545 * @brief Clear flag ADC analog watchdog 3.
Kojto 122:f9eeca106725 6546 * @rmtoll ISR AWD3 LL_ADC_ClearFlag_AWD3
Kojto 122:f9eeca106725 6547 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6548 * @retval None
Kojto 122:f9eeca106725 6549 */
Kojto 122:f9eeca106725 6550 __STATIC_INLINE void LL_ADC_ClearFlag_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6551 {
Kojto 122:f9eeca106725 6552 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD3);
Kojto 122:f9eeca106725 6553 }
Kojto 122:f9eeca106725 6554
Kojto 122:f9eeca106725 6555 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 6556 /**
Kojto 122:f9eeca106725 6557 * @brief Get flag multimode ADC ready of the ADC master.
Kojto 122:f9eeca106725 6558 * @rmtoll CSR ADRDY_MST LL_ADC_IsActiveFlag_MST_ADRDY
Kojto 122:f9eeca106725 6559 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6560 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6561 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6562 */
Kojto 122:f9eeca106725 6563 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6564 {
Kojto 122:f9eeca106725 6565 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_MST) == (LL_ADC_FLAG_ADRDY_MST));
Kojto 122:f9eeca106725 6566 }
Kojto 122:f9eeca106725 6567
Kojto 122:f9eeca106725 6568 /**
Kojto 122:f9eeca106725 6569 * @brief Get flag multimode ADC ready of the ADC slave.
Kojto 122:f9eeca106725 6570 * @rmtoll CSR ADRDY_SLV LL_ADC_IsActiveFlag_SLV_ADRDY
Kojto 122:f9eeca106725 6571 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6572 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6573 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6574 */
Kojto 122:f9eeca106725 6575 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6576 {
Kojto 122:f9eeca106725 6577 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_SLV) == (LL_ADC_FLAG_ADRDY_SLV));
Kojto 122:f9eeca106725 6578 }
Kojto 122:f9eeca106725 6579
Kojto 122:f9eeca106725 6580 /**
Kojto 122:f9eeca106725 6581 * @brief Get flag multimode ADC group regular end of unitary conversion of the ADC master.
Kojto 122:f9eeca106725 6582 * @rmtoll CSR EOC_MST LL_ADC_IsActiveFlag_MST_EOC
Kojto 122:f9eeca106725 6583 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6584 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6585 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6586 */
Kojto 122:f9eeca106725 6587 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6588 {
Kojto 122:f9eeca106725 6589 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV));
Kojto 122:f9eeca106725 6590 }
Kojto 122:f9eeca106725 6591
Kojto 122:f9eeca106725 6592 /**
Kojto 122:f9eeca106725 6593 * @brief Get flag multimode ADC group regular end of unitary conversion of the ADC slave.
Kojto 122:f9eeca106725 6594 * @rmtoll CSR EOC_SLV LL_ADC_IsActiveFlag_SLV_EOC
Kojto 122:f9eeca106725 6595 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6596 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6597 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6598 */
Kojto 122:f9eeca106725 6599 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6600 {
Kojto 122:f9eeca106725 6601 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV));
Kojto 122:f9eeca106725 6602 }
Kojto 122:f9eeca106725 6603
Kojto 122:f9eeca106725 6604 /**
Kojto 122:f9eeca106725 6605 * @brief Get flag multimode ADC group regular end of sequence conversions of the ADC master.
Kojto 122:f9eeca106725 6606 * @rmtoll CSR EOS_MST LL_ADC_IsActiveFlag_MST_EOS
Kojto 122:f9eeca106725 6607 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6608 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6609 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6610 */
Kojto 122:f9eeca106725 6611 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6612 {
Kojto 122:f9eeca106725 6613 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_MST) == (LL_ADC_FLAG_EOS_MST));
Kojto 122:f9eeca106725 6614 }
Kojto 122:f9eeca106725 6615
Kojto 122:f9eeca106725 6616 /**
Kojto 122:f9eeca106725 6617 * @brief Get flag multimode ADC group regular end of sequence conversions of the ADC slave.
Kojto 122:f9eeca106725 6618 * @rmtoll CSR EOS_SLV LL_ADC_IsActiveFlag_SLV_EOS
Kojto 122:f9eeca106725 6619 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6620 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6621 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6622 */
Kojto 122:f9eeca106725 6623 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6624 {
Kojto 122:f9eeca106725 6625 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_SLV) == (LL_ADC_FLAG_EOS_SLV));
Kojto 122:f9eeca106725 6626 }
Kojto 122:f9eeca106725 6627
Kojto 122:f9eeca106725 6628 /**
Kojto 122:f9eeca106725 6629 * @brief Get flag multimode ADC group regular overrun of the ADC master.
Kojto 122:f9eeca106725 6630 * @rmtoll CSR OVR_MST LL_ADC_IsActiveFlag_MST_OVR
Kojto 122:f9eeca106725 6631 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6632 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6633 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6634 */
Kojto 122:f9eeca106725 6635 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6636 {
Kojto 122:f9eeca106725 6637 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_MST) == (LL_ADC_FLAG_OVR_MST));
Kojto 122:f9eeca106725 6638 }
Kojto 122:f9eeca106725 6639
Kojto 122:f9eeca106725 6640 /**
Kojto 122:f9eeca106725 6641 * @brief Get flag multimode ADC group regular overrun of the ADC slave.
Kojto 122:f9eeca106725 6642 * @rmtoll CSR OVR_SLV LL_ADC_IsActiveFlag_SLV_OVR
Kojto 122:f9eeca106725 6643 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6644 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6645 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6646 */
Kojto 122:f9eeca106725 6647 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6648 {
Kojto 122:f9eeca106725 6649 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_SLV) == (LL_ADC_FLAG_OVR_SLV));
Kojto 122:f9eeca106725 6650 }
Kojto 122:f9eeca106725 6651
Kojto 122:f9eeca106725 6652 /**
Kojto 122:f9eeca106725 6653 * @brief Get flag multimode ADC group regular end of sampling of the ADC master.
Kojto 122:f9eeca106725 6654 * @rmtoll CSR EOSMP_MST LL_ADC_IsActiveFlag_MST_EOSMP
Kojto 122:f9eeca106725 6655 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6656 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6657 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6658 */
Kojto 122:f9eeca106725 6659 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6660 {
Kojto 122:f9eeca106725 6661 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_MST) == (LL_ADC_FLAG_EOSMP_MST));
Kojto 122:f9eeca106725 6662 }
Kojto 122:f9eeca106725 6663
Kojto 122:f9eeca106725 6664 /**
Kojto 122:f9eeca106725 6665 * @brief Get flag multimode ADC group regular end of sampling of the ADC slave.
Kojto 122:f9eeca106725 6666 * @rmtoll CSR EOSMP_SLV LL_ADC_IsActiveFlag_SLV_EOSMP
Kojto 122:f9eeca106725 6667 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6668 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6669 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6670 */
Kojto 122:f9eeca106725 6671 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6672 {
Kojto 122:f9eeca106725 6673 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_SLV) == (LL_ADC_FLAG_EOSMP_SLV));
Kojto 122:f9eeca106725 6674 }
Kojto 122:f9eeca106725 6675
Kojto 122:f9eeca106725 6676 /**
Kojto 122:f9eeca106725 6677 * @brief Get flag multimode ADC group injected end of unitary conversion of the ADC master.
Kojto 122:f9eeca106725 6678 * @rmtoll CSR JEOC_MST LL_ADC_IsActiveFlag_MST_JEOC
Kojto 122:f9eeca106725 6679 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6680 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6681 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6682 */
Kojto 122:f9eeca106725 6683 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6684 {
Kojto 122:f9eeca106725 6685 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_MST) == (LL_ADC_FLAG_JEOC_MST));
Kojto 122:f9eeca106725 6686 }
Kojto 122:f9eeca106725 6687
Kojto 122:f9eeca106725 6688 /**
Kojto 122:f9eeca106725 6689 * @brief Get flag multimode ADC group injected end of unitary conversion of the ADC slave.
Kojto 122:f9eeca106725 6690 * @rmtoll CSR JEOC_SLV LL_ADC_IsActiveFlag_SLV_JEOC
Kojto 122:f9eeca106725 6691 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6692 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6693 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6694 */
Kojto 122:f9eeca106725 6695 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6696 {
Kojto 122:f9eeca106725 6697 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_SLV) == (LL_ADC_FLAG_JEOC_SLV));
Kojto 122:f9eeca106725 6698 }
Kojto 122:f9eeca106725 6699
Kojto 122:f9eeca106725 6700 /**
Kojto 122:f9eeca106725 6701 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC master.
Kojto 122:f9eeca106725 6702 * @rmtoll CSR JEOS_MST LL_ADC_IsActiveFlag_MST_JEOS
Kojto 122:f9eeca106725 6703 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6704 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6705 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6706 */
Kojto 122:f9eeca106725 6707 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6708 {
Kojto 122:f9eeca106725 6709 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_MST) == (LL_ADC_FLAG_JEOS_MST));
Kojto 122:f9eeca106725 6710 }
Kojto 122:f9eeca106725 6711
Kojto 122:f9eeca106725 6712 /**
Kojto 122:f9eeca106725 6713 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC slave.
Kojto 122:f9eeca106725 6714 * @rmtoll CSR JEOS_SLV LL_ADC_IsActiveFlag_SLV_JEOS
Kojto 122:f9eeca106725 6715 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6716 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6717 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6718 */
Kojto 122:f9eeca106725 6719 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6720 {
Kojto 122:f9eeca106725 6721 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_SLV) == (LL_ADC_FLAG_JEOS_SLV));
Kojto 122:f9eeca106725 6722 }
Kojto 122:f9eeca106725 6723
Kojto 122:f9eeca106725 6724 /**
Kojto 122:f9eeca106725 6725 * @brief Get flag multimode ADC group injected context queue overflow of the ADC master.
Kojto 122:f9eeca106725 6726 * @rmtoll CSR JQOVF_MST LL_ADC_IsActiveFlag_MST_JQOVF
Kojto 122:f9eeca106725 6727 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6728 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6729 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6730 */
Kojto 122:f9eeca106725 6731 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6732 {
Kojto 122:f9eeca106725 6733 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_MST) == (LL_ADC_FLAG_JQOVF_MST));
Kojto 122:f9eeca106725 6734 }
Kojto 122:f9eeca106725 6735
Kojto 122:f9eeca106725 6736 /**
Kojto 122:f9eeca106725 6737 * @brief Get flag multimode ADC group injected context queue overflow of the ADC slave.
Kojto 122:f9eeca106725 6738 * @rmtoll CSR JQOVF_SLV LL_ADC_IsActiveFlag_SLV_JQOVF
Kojto 122:f9eeca106725 6739 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6740 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6741 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6742 */
Kojto 122:f9eeca106725 6743 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6744 {
Kojto 122:f9eeca106725 6745 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_SLV) == (LL_ADC_FLAG_JQOVF_SLV));
Kojto 122:f9eeca106725 6746 }
Kojto 122:f9eeca106725 6747
Kojto 122:f9eeca106725 6748 /**
Kojto 122:f9eeca106725 6749 * @brief Get flag multimode ADC analog watchdog 1 of the ADC master.
Kojto 122:f9eeca106725 6750 * @rmtoll CSR AWD1_MST LL_ADC_IsActiveFlag_MST_AWD1
Kojto 122:f9eeca106725 6751 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6752 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6753 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6754 */
Kojto 122:f9eeca106725 6755 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6756 {
Kojto 122:f9eeca106725 6757 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_MST) == (LL_ADC_FLAG_AWD1_MST));
Kojto 122:f9eeca106725 6758 }
Kojto 122:f9eeca106725 6759
Kojto 122:f9eeca106725 6760 /**
Kojto 122:f9eeca106725 6761 * @brief Get flag multimode analog watchdog 1 of the ADC slave.
Kojto 122:f9eeca106725 6762 * @rmtoll CSR AWD1_SLV LL_ADC_IsActiveFlag_SLV_AWD1
Kojto 122:f9eeca106725 6763 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6764 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6765 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6766 */
Kojto 122:f9eeca106725 6767 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6768 {
Kojto 122:f9eeca106725 6769 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_SLV) == (LL_ADC_FLAG_AWD1_SLV));
Kojto 122:f9eeca106725 6770 }
Kojto 122:f9eeca106725 6771
Kojto 122:f9eeca106725 6772 /**
Kojto 122:f9eeca106725 6773 * @brief Get flag multimode ADC analog watchdog 2 of the ADC master.
Kojto 122:f9eeca106725 6774 * @rmtoll CSR AWD2_MST LL_ADC_IsActiveFlag_MST_AWD2
Kojto 122:f9eeca106725 6775 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6776 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6777 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6778 */
Kojto 122:f9eeca106725 6779 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6780 {
Kojto 122:f9eeca106725 6781 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_MST) == (LL_ADC_FLAG_AWD2_MST));
Kojto 122:f9eeca106725 6782 }
Kojto 122:f9eeca106725 6783
Kojto 122:f9eeca106725 6784 /**
Kojto 122:f9eeca106725 6785 * @brief Get flag multimode ADC analog watchdog 2 of the ADC slave.
Kojto 122:f9eeca106725 6786 * @rmtoll CSR AWD2_SLV LL_ADC_IsActiveFlag_SLV_AWD2
Kojto 122:f9eeca106725 6787 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6788 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6789 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6790 */
Kojto 122:f9eeca106725 6791 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6792 {
Kojto 122:f9eeca106725 6793 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_SLV) == (LL_ADC_FLAG_AWD2_SLV));
Kojto 122:f9eeca106725 6794 }
Kojto 122:f9eeca106725 6795
Kojto 122:f9eeca106725 6796 /**
Kojto 122:f9eeca106725 6797 * @brief Get flag multimode ADC analog watchdog 3 of the ADC master.
Kojto 122:f9eeca106725 6798 * @rmtoll CSR AWD3_MST LL_ADC_IsActiveFlag_MST_AWD3
Kojto 122:f9eeca106725 6799 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6800 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6801 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6802 */
Kojto 122:f9eeca106725 6803 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6804 {
Kojto 122:f9eeca106725 6805 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_MST) == (LL_ADC_FLAG_AWD3_MST));
Kojto 122:f9eeca106725 6806 }
Kojto 122:f9eeca106725 6807
Kojto 122:f9eeca106725 6808 /**
Kojto 122:f9eeca106725 6809 * @brief Get flag multimode ADC analog watchdog 3 of the ADC slave.
Kojto 122:f9eeca106725 6810 * @rmtoll CSR AWD3_SLV LL_ADC_IsActiveFlag_SLV_AWD3
Kojto 122:f9eeca106725 6811 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6812 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6813 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6814 */
Kojto 122:f9eeca106725 6815 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6816 {
Kojto 122:f9eeca106725 6817 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_SLV) == (LL_ADC_FLAG_AWD3_SLV));
Kojto 122:f9eeca106725 6818 }
Kojto 122:f9eeca106725 6819 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 6820
Kojto 122:f9eeca106725 6821 /**
Kojto 122:f9eeca106725 6822 * @}
Kojto 122:f9eeca106725 6823 */
Kojto 122:f9eeca106725 6824
Kojto 122:f9eeca106725 6825 /** @defgroup ADC_LL_EF_IT_Management ADC IT management
Kojto 122:f9eeca106725 6826 * @{
Kojto 122:f9eeca106725 6827 */
Kojto 122:f9eeca106725 6828
Kojto 122:f9eeca106725 6829 /**
Kojto 122:f9eeca106725 6830 * @brief Enable ADC ready.
Kojto 122:f9eeca106725 6831 * @rmtoll IER ADRDYIE LL_ADC_EnableIT_ADRDY
Kojto 122:f9eeca106725 6832 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6833 * @retval None
Kojto 122:f9eeca106725 6834 */
Kojto 122:f9eeca106725 6835 __STATIC_INLINE void LL_ADC_EnableIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6836 {
Kojto 122:f9eeca106725 6837 SET_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
Kojto 122:f9eeca106725 6838 }
Kojto 122:f9eeca106725 6839
Kojto 122:f9eeca106725 6840 /**
Kojto 122:f9eeca106725 6841 * @brief Enable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6842 * @rmtoll IER EOCIE LL_ADC_EnableIT_EOC
Kojto 122:f9eeca106725 6843 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6844 * @retval None
Kojto 122:f9eeca106725 6845 */
Kojto 122:f9eeca106725 6846 __STATIC_INLINE void LL_ADC_EnableIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6847 {
Kojto 122:f9eeca106725 6848 SET_BIT(ADCx->IER, LL_ADC_IT_EOC);
Kojto 122:f9eeca106725 6849 }
Kojto 122:f9eeca106725 6850
Kojto 122:f9eeca106725 6851 /**
Kojto 122:f9eeca106725 6852 * @brief Enable interruption ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6853 * @rmtoll IER EOSIE LL_ADC_EnableIT_EOS
Kojto 122:f9eeca106725 6854 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6855 * @retval None
Kojto 122:f9eeca106725 6856 */
Kojto 122:f9eeca106725 6857 __STATIC_INLINE void LL_ADC_EnableIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6858 {
Kojto 122:f9eeca106725 6859 SET_BIT(ADCx->IER, LL_ADC_IT_EOS);
Kojto 122:f9eeca106725 6860 }
Kojto 122:f9eeca106725 6861
Kojto 122:f9eeca106725 6862 /**
Kojto 122:f9eeca106725 6863 * @brief Enable ADC group regular interruption overrun.
Kojto 122:f9eeca106725 6864 * @rmtoll IER OVRIE LL_ADC_EnableIT_OVR
Kojto 122:f9eeca106725 6865 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6866 * @retval None
Kojto 122:f9eeca106725 6867 */
Kojto 122:f9eeca106725 6868 __STATIC_INLINE void LL_ADC_EnableIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6869 {
Kojto 122:f9eeca106725 6870 SET_BIT(ADCx->IER, LL_ADC_IT_OVR);
Kojto 122:f9eeca106725 6871 }
Kojto 122:f9eeca106725 6872
Kojto 122:f9eeca106725 6873 /**
Kojto 122:f9eeca106725 6874 * @brief Enable interruption ADC group regular end of sampling.
Kojto 122:f9eeca106725 6875 * @rmtoll IER EOSMPIE LL_ADC_EnableIT_EOSMP
Kojto 122:f9eeca106725 6876 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6877 * @retval None
Kojto 122:f9eeca106725 6878 */
Kojto 122:f9eeca106725 6879 __STATIC_INLINE void LL_ADC_EnableIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6880 {
Kojto 122:f9eeca106725 6881 SET_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
Kojto 122:f9eeca106725 6882 }
Kojto 122:f9eeca106725 6883
Kojto 122:f9eeca106725 6884 /**
Kojto 122:f9eeca106725 6885 * @brief Enable interruption ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6886 * @rmtoll IER JEOCIE LL_ADC_EnableIT_JEOC
Kojto 122:f9eeca106725 6887 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6888 * @retval None
Kojto 122:f9eeca106725 6889 */
Kojto 122:f9eeca106725 6890 __STATIC_INLINE void LL_ADC_EnableIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6891 {
Kojto 122:f9eeca106725 6892 SET_BIT(ADCx->IER, LL_ADC_IT_JEOC);
Kojto 122:f9eeca106725 6893 }
Kojto 122:f9eeca106725 6894
Kojto 122:f9eeca106725 6895 /**
Kojto 122:f9eeca106725 6896 * @brief Enable interruption ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 6897 * @rmtoll IER JEOSIE LL_ADC_EnableIT_JEOS
Kojto 122:f9eeca106725 6898 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6899 * @retval None
Kojto 122:f9eeca106725 6900 */
Kojto 122:f9eeca106725 6901 __STATIC_INLINE void LL_ADC_EnableIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6902 {
Kojto 122:f9eeca106725 6903 SET_BIT(ADCx->IER, LL_ADC_IT_JEOS);
Kojto 122:f9eeca106725 6904 }
Kojto 122:f9eeca106725 6905
Kojto 122:f9eeca106725 6906 /**
Kojto 122:f9eeca106725 6907 * @brief Enable interruption ADC group injected context queue overflow.
Kojto 122:f9eeca106725 6908 * @rmtoll IER JQOVFIE LL_ADC_EnableIT_JQOVF
Kojto 122:f9eeca106725 6909 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6910 * @retval None
Kojto 122:f9eeca106725 6911 */
Kojto 122:f9eeca106725 6912 __STATIC_INLINE void LL_ADC_EnableIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6913 {
Kojto 122:f9eeca106725 6914 SET_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
Kojto 122:f9eeca106725 6915 }
Kojto 122:f9eeca106725 6916
Kojto 122:f9eeca106725 6917 /**
Kojto 122:f9eeca106725 6918 * @brief Enable interruption ADC analog watchdog 1.
Kojto 122:f9eeca106725 6919 * @rmtoll IER AWD1IE LL_ADC_EnableIT_AWD1
Kojto 122:f9eeca106725 6920 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6921 * @retval None
Kojto 122:f9eeca106725 6922 */
Kojto 122:f9eeca106725 6923 __STATIC_INLINE void LL_ADC_EnableIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6924 {
Kojto 122:f9eeca106725 6925 SET_BIT(ADCx->IER, LL_ADC_IT_AWD1);
Kojto 122:f9eeca106725 6926 }
Kojto 122:f9eeca106725 6927
Kojto 122:f9eeca106725 6928 /**
Kojto 122:f9eeca106725 6929 * @brief Enable interruption ADC analog watchdog 2.
Kojto 122:f9eeca106725 6930 * @rmtoll IER AWD2IE LL_ADC_EnableIT_AWD2
Kojto 122:f9eeca106725 6931 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6932 * @retval None
Kojto 122:f9eeca106725 6933 */
Kojto 122:f9eeca106725 6934 __STATIC_INLINE void LL_ADC_EnableIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6935 {
Kojto 122:f9eeca106725 6936 SET_BIT(ADCx->IER, LL_ADC_IT_AWD2);
Kojto 122:f9eeca106725 6937 }
Kojto 122:f9eeca106725 6938
Kojto 122:f9eeca106725 6939 /**
Kojto 122:f9eeca106725 6940 * @brief Enable interruption ADC analog watchdog 3.
Kojto 122:f9eeca106725 6941 * @rmtoll IER AWD3IE LL_ADC_EnableIT_AWD3
Kojto 122:f9eeca106725 6942 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6943 * @retval None
Kojto 122:f9eeca106725 6944 */
Kojto 122:f9eeca106725 6945 __STATIC_INLINE void LL_ADC_EnableIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6946 {
Kojto 122:f9eeca106725 6947 SET_BIT(ADCx->IER, LL_ADC_IT_AWD3);
Kojto 122:f9eeca106725 6948 }
Kojto 122:f9eeca106725 6949
Kojto 122:f9eeca106725 6950 /**
Kojto 122:f9eeca106725 6951 * @brief Disable interruption ADC ready.
Kojto 122:f9eeca106725 6952 * @rmtoll IER ADRDYIE LL_ADC_DisableIT_ADRDY
Kojto 122:f9eeca106725 6953 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6954 * @retval None
Kojto 122:f9eeca106725 6955 */
Kojto 122:f9eeca106725 6956 __STATIC_INLINE void LL_ADC_DisableIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6957 {
Kojto 122:f9eeca106725 6958 CLEAR_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
Kojto 122:f9eeca106725 6959 }
Kojto 122:f9eeca106725 6960
Kojto 122:f9eeca106725 6961 /**
Kojto 122:f9eeca106725 6962 * @brief Disable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6963 * @rmtoll IER EOCIE LL_ADC_DisableIT_EOC
Kojto 122:f9eeca106725 6964 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6965 * @retval None
Kojto 122:f9eeca106725 6966 */
Kojto 122:f9eeca106725 6967 __STATIC_INLINE void LL_ADC_DisableIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6968 {
Kojto 122:f9eeca106725 6969 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOC);
Kojto 122:f9eeca106725 6970 }
Kojto 122:f9eeca106725 6971
Kojto 122:f9eeca106725 6972 /**
Kojto 122:f9eeca106725 6973 * @brief Disable interruption ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6974 * @rmtoll IER EOSIE LL_ADC_DisableIT_EOS
Kojto 122:f9eeca106725 6975 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6976 * @retval None
Kojto 122:f9eeca106725 6977 */
Kojto 122:f9eeca106725 6978 __STATIC_INLINE void LL_ADC_DisableIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6979 {
Kojto 122:f9eeca106725 6980 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOS);
Kojto 122:f9eeca106725 6981 }
Kojto 122:f9eeca106725 6982
Kojto 122:f9eeca106725 6983 /**
Kojto 122:f9eeca106725 6984 * @brief Disable interruption ADC group regular overrun.
Kojto 122:f9eeca106725 6985 * @rmtoll IER OVRIE LL_ADC_DisableIT_OVR
Kojto 122:f9eeca106725 6986 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6987 * @retval None
Kojto 122:f9eeca106725 6988 */
Kojto 122:f9eeca106725 6989 __STATIC_INLINE void LL_ADC_DisableIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6990 {
Kojto 122:f9eeca106725 6991 CLEAR_BIT(ADCx->IER, LL_ADC_IT_OVR);
Kojto 122:f9eeca106725 6992 }
Kojto 122:f9eeca106725 6993
Kojto 122:f9eeca106725 6994 /**
Kojto 122:f9eeca106725 6995 * @brief Disable interruption ADC group regular end of sampling.
Kojto 122:f9eeca106725 6996 * @rmtoll IER EOSMPIE LL_ADC_DisableIT_EOSMP
Kojto 122:f9eeca106725 6997 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6998 * @retval None
Kojto 122:f9eeca106725 6999 */
Kojto 122:f9eeca106725 7000 __STATIC_INLINE void LL_ADC_DisableIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7001 {
Kojto 122:f9eeca106725 7002 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
Kojto 122:f9eeca106725 7003 }
Kojto 122:f9eeca106725 7004
Kojto 122:f9eeca106725 7005 /**
Kojto 122:f9eeca106725 7006 * @brief Disable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 7007 * @rmtoll IER JEOCIE LL_ADC_DisableIT_JEOC
Kojto 122:f9eeca106725 7008 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7009 * @retval None
Kojto 122:f9eeca106725 7010 */
Kojto 122:f9eeca106725 7011 __STATIC_INLINE void LL_ADC_DisableIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7012 {
Kojto 122:f9eeca106725 7013 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOC);
Kojto 122:f9eeca106725 7014 }
Kojto 122:f9eeca106725 7015
Kojto 122:f9eeca106725 7016 /**
Kojto 122:f9eeca106725 7017 * @brief Disable interruption ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 7018 * @rmtoll IER JEOSIE LL_ADC_DisableIT_JEOS
Kojto 122:f9eeca106725 7019 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7020 * @retval None
Kojto 122:f9eeca106725 7021 */
Kojto 122:f9eeca106725 7022 __STATIC_INLINE void LL_ADC_DisableIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7023 {
Kojto 122:f9eeca106725 7024 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOS);
Kojto 122:f9eeca106725 7025 }
Kojto 122:f9eeca106725 7026
Kojto 122:f9eeca106725 7027 /**
Kojto 122:f9eeca106725 7028 * @brief Disable interruption ADC group injected context queue overflow.
Kojto 122:f9eeca106725 7029 * @rmtoll IER JQOVFIE LL_ADC_DisableIT_JQOVF
Kojto 122:f9eeca106725 7030 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7031 * @retval None
Kojto 122:f9eeca106725 7032 */
Kojto 122:f9eeca106725 7033 __STATIC_INLINE void LL_ADC_DisableIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7034 {
Kojto 122:f9eeca106725 7035 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
Kojto 122:f9eeca106725 7036 }
Kojto 122:f9eeca106725 7037
Kojto 122:f9eeca106725 7038 /**
Kojto 122:f9eeca106725 7039 * @brief Disable interruption ADC analog watchdog 1.
Kojto 122:f9eeca106725 7040 * @rmtoll IER AWD1IE LL_ADC_DisableIT_AWD1
Kojto 122:f9eeca106725 7041 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7042 * @retval None
Kojto 122:f9eeca106725 7043 */
Kojto 122:f9eeca106725 7044 __STATIC_INLINE void LL_ADC_DisableIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7045 {
Kojto 122:f9eeca106725 7046 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD1);
Kojto 122:f9eeca106725 7047 }
Kojto 122:f9eeca106725 7048
Kojto 122:f9eeca106725 7049 /**
Kojto 122:f9eeca106725 7050 * @brief Disable interruption ADC analog watchdog 2.
Kojto 122:f9eeca106725 7051 * @rmtoll IER AWD2IE LL_ADC_DisableIT_AWD2
Kojto 122:f9eeca106725 7052 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7053 * @retval None
Kojto 122:f9eeca106725 7054 */
Kojto 122:f9eeca106725 7055 __STATIC_INLINE void LL_ADC_DisableIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7056 {
Kojto 122:f9eeca106725 7057 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD2);
Kojto 122:f9eeca106725 7058 }
Kojto 122:f9eeca106725 7059
Kojto 122:f9eeca106725 7060 /**
Kojto 122:f9eeca106725 7061 * @brief Disable interruption ADC analog watchdog 3.
Kojto 122:f9eeca106725 7062 * @rmtoll IER AWD3IE LL_ADC_DisableIT_AWD3
Kojto 122:f9eeca106725 7063 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7064 * @retval None
Kojto 122:f9eeca106725 7065 */
Kojto 122:f9eeca106725 7066 __STATIC_INLINE void LL_ADC_DisableIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7067 {
Kojto 122:f9eeca106725 7068 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD3);
Kojto 122:f9eeca106725 7069 }
Kojto 122:f9eeca106725 7070
Kojto 122:f9eeca106725 7071 /**
Kojto 122:f9eeca106725 7072 * @brief Get state of interruption ADC ready
Kojto 122:f9eeca106725 7073 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7074 * @rmtoll IER ADRDYIE LL_ADC_IsEnabledIT_ADRDY
Kojto 122:f9eeca106725 7075 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7076 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7077 */
Kojto 122:f9eeca106725 7078 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7079 {
Kojto 122:f9eeca106725 7080 return (READ_BIT(ADCx->IER, LL_ADC_IT_ADRDY) == (LL_ADC_IT_ADRDY));
Kojto 122:f9eeca106725 7081 }
Kojto 122:f9eeca106725 7082
Kojto 122:f9eeca106725 7083 /**
Kojto 122:f9eeca106725 7084 * @brief Get state of interruption ADC group regular end of unitary conversion
Kojto 122:f9eeca106725 7085 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7086 * @rmtoll IER EOCIE LL_ADC_IsEnabledIT_EOC
Kojto 122:f9eeca106725 7087 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7088 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7089 */
Kojto 122:f9eeca106725 7090 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7091 {
Kojto 122:f9eeca106725 7092 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOC) == (LL_ADC_IT_EOC));
Kojto 122:f9eeca106725 7093 }
Kojto 122:f9eeca106725 7094
Kojto 122:f9eeca106725 7095 /**
Kojto 122:f9eeca106725 7096 * @brief Get state of interruption ADC group regular end of sequence conversions
Kojto 122:f9eeca106725 7097 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7098 * @rmtoll IER EOSIE LL_ADC_IsEnabledIT_EOS
Kojto 122:f9eeca106725 7099 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7100 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7101 */
Kojto 122:f9eeca106725 7102 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7103 {
Kojto 122:f9eeca106725 7104 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOS) == (LL_ADC_IT_EOS));
Kojto 122:f9eeca106725 7105 }
Kojto 122:f9eeca106725 7106
Kojto 122:f9eeca106725 7107 /**
Kojto 122:f9eeca106725 7108 * @brief Get state of interruption ADC group regular overrun
Kojto 122:f9eeca106725 7109 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7110 * @rmtoll IER OVRIE LL_ADC_IsEnabledIT_OVR
Kojto 122:f9eeca106725 7111 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7112 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7113 */
Kojto 122:f9eeca106725 7114 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7115 {
Kojto 122:f9eeca106725 7116 return (READ_BIT(ADCx->IER, LL_ADC_IT_OVR) == (LL_ADC_IT_OVR));
Kojto 122:f9eeca106725 7117 }
Kojto 122:f9eeca106725 7118
Kojto 122:f9eeca106725 7119 /**
Kojto 122:f9eeca106725 7120 * @brief Get state of interruption ADC group regular end of sampling
Kojto 122:f9eeca106725 7121 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7122 * @rmtoll IER EOSMPIE LL_ADC_IsEnabledIT_EOSMP
Kojto 122:f9eeca106725 7123 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7124 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7125 */
Kojto 122:f9eeca106725 7126 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7127 {
Kojto 122:f9eeca106725 7128 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOSMP) == (LL_ADC_IT_EOSMP));
Kojto 122:f9eeca106725 7129 }
Kojto 122:f9eeca106725 7130
Kojto 122:f9eeca106725 7131 /**
Kojto 122:f9eeca106725 7132 * @brief Get state of interruption ADC group injected end of unitary conversion
Kojto 122:f9eeca106725 7133 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7134 * @rmtoll IER JEOCIE LL_ADC_IsEnabledIT_JEOC
Kojto 122:f9eeca106725 7135 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7136 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7137 */
Kojto 122:f9eeca106725 7138 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7139 {
Kojto 122:f9eeca106725 7140 return (READ_BIT(ADCx->IER, LL_ADC_IT_JEOC) == (LL_ADC_IT_JEOC));
Kojto 122:f9eeca106725 7141 }
Kojto 122:f9eeca106725 7142
Kojto 122:f9eeca106725 7143 /**
Kojto 122:f9eeca106725 7144 * @brief Get state of interruption ADC group injected end of sequence conversions
Kojto 122:f9eeca106725 7145 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7146 * @rmtoll IER JEOSIE LL_ADC_IsEnabledIT_JEOS
Kojto 122:f9eeca106725 7147 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7148 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7149 */
Kojto 122:f9eeca106725 7150 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7151 {
Kojto 122:f9eeca106725 7152 return (READ_BIT(ADCx->IER, LL_ADC_IT_JEOS) == (LL_ADC_IT_JEOS));
Kojto 122:f9eeca106725 7153 }
Kojto 122:f9eeca106725 7154
Kojto 122:f9eeca106725 7155 /**
Kojto 122:f9eeca106725 7156 * @brief Get state of interruption ADC group injected context queue overflow interrupt state
Kojto 122:f9eeca106725 7157 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7158 * @rmtoll IER JQOVFIE LL_ADC_IsEnabledIT_JQOVF
Kojto 122:f9eeca106725 7159 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7160 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7161 */
Kojto 122:f9eeca106725 7162 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7163 {
Kojto 122:f9eeca106725 7164 return (READ_BIT(ADCx->IER, LL_ADC_IT_JQOVF) == (LL_ADC_IT_JQOVF));
Kojto 122:f9eeca106725 7165 }
Kojto 122:f9eeca106725 7166
Kojto 122:f9eeca106725 7167 /**
Kojto 122:f9eeca106725 7168 * @brief Get state of interruption ADC analog watchdog 1
Kojto 122:f9eeca106725 7169 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7170 * @rmtoll IER AWD1IE LL_ADC_IsEnabledIT_AWD1
Kojto 122:f9eeca106725 7171 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7172 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7173 */
Kojto 122:f9eeca106725 7174 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7175 {
Kojto 122:f9eeca106725 7176 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD1) == (LL_ADC_IT_AWD1));
Kojto 122:f9eeca106725 7177 }
Kojto 122:f9eeca106725 7178
Kojto 122:f9eeca106725 7179 /**
Kojto 122:f9eeca106725 7180 * @brief Get state of interruption Get ADC analog watchdog 2
Kojto 122:f9eeca106725 7181 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7182 * @rmtoll IER AWD2IE LL_ADC_IsEnabledIT_AWD2
Kojto 122:f9eeca106725 7183 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7184 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7185 */
Kojto 122:f9eeca106725 7186 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7187 {
Kojto 122:f9eeca106725 7188 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD2) == (LL_ADC_IT_AWD2));
Kojto 122:f9eeca106725 7189 }
Kojto 122:f9eeca106725 7190
Kojto 122:f9eeca106725 7191 /**
Kojto 122:f9eeca106725 7192 * @brief Get state of interruption Get ADC analog watchdog 3
Kojto 122:f9eeca106725 7193 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7194 * @rmtoll IER AWD3IE LL_ADC_IsEnabledIT_AWD3
Kojto 122:f9eeca106725 7195 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7196 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7197 */
Kojto 122:f9eeca106725 7198 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7199 {
Kojto 122:f9eeca106725 7200 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD3) == (LL_ADC_IT_AWD3));
Kojto 122:f9eeca106725 7201 }
Kojto 122:f9eeca106725 7202
Kojto 122:f9eeca106725 7203 /**
Kojto 122:f9eeca106725 7204 * @}
Kojto 122:f9eeca106725 7205 */
Kojto 122:f9eeca106725 7206
Kojto 122:f9eeca106725 7207 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 7208 /** @defgroup ADC_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 7209 * @{
Kojto 122:f9eeca106725 7210 */
Kojto 122:f9eeca106725 7211
Kojto 122:f9eeca106725 7212 /* Initialization of some features of ADC common parameters and multimode */
Kojto 122:f9eeca106725 7213 ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON);
Kojto 122:f9eeca106725 7214 ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
Kojto 122:f9eeca106725 7215 void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
Kojto 122:f9eeca106725 7216
Kojto 122:f9eeca106725 7217 /* De-initialization of ADC instance, ADC group regular and ADC group injected */
Kojto 122:f9eeca106725 7218 /* (availability of ADC group injected depends on STM32 families) */
Kojto 122:f9eeca106725 7219 ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx);
Kojto 122:f9eeca106725 7220
Kojto 122:f9eeca106725 7221 /* Initialization of some features of ADC instance */
Kojto 122:f9eeca106725 7222 ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct);
Kojto 122:f9eeca106725 7223 void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct);
Kojto 122:f9eeca106725 7224
Kojto 122:f9eeca106725 7225 /* Initialization of some features of ADC instance and ADC group regular */
Kojto 122:f9eeca106725 7226 ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
Kojto 122:f9eeca106725 7227 void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
Kojto 122:f9eeca106725 7228
Kojto 122:f9eeca106725 7229 /* Initialization of some features of ADC instance and ADC group injected */
Kojto 122:f9eeca106725 7230 ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
Kojto 122:f9eeca106725 7231 void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
Kojto 122:f9eeca106725 7232
Kojto 122:f9eeca106725 7233 /**
Kojto 122:f9eeca106725 7234 * @}
Kojto 122:f9eeca106725 7235 */
Kojto 122:f9eeca106725 7236 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 7237
Kojto 122:f9eeca106725 7238 /**
Kojto 122:f9eeca106725 7239 * @}
Kojto 122:f9eeca106725 7240 */
Kojto 122:f9eeca106725 7241
Kojto 122:f9eeca106725 7242 /**
Kojto 122:f9eeca106725 7243 * @}
Kojto 122:f9eeca106725 7244 */
Kojto 122:f9eeca106725 7245
Kojto 122:f9eeca106725 7246 #endif /* ADC1 || ADC2 || ADC3 */
Kojto 122:f9eeca106725 7247
Kojto 122:f9eeca106725 7248 /**
Kojto 122:f9eeca106725 7249 * @}
Kojto 122:f9eeca106725 7250 */
Kojto 122:f9eeca106725 7251
Kojto 122:f9eeca106725 7252 #ifdef __cplusplus
Kojto 122:f9eeca106725 7253 }
Kojto 122:f9eeca106725 7254 #endif
Kojto 122:f9eeca106725 7255
Kojto 122:f9eeca106725 7256 #endif /* __STM32L4xx_LL_ADC_H */
Kojto 122:f9eeca106725 7257
Kojto 122:f9eeca106725 7258 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/