DIY Logging Volt/Ampmeter
stm32f1xx_ll_adc.c
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file stm32f1xx_ll_adc.c
4  * @author MCD Application Team
5  * @brief ADC LL module driver
6  ******************************************************************************
7  * @attention
8  *
9  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
10  * All rights reserved.</center></h2>
11  *
12  * This software component is licensed by ST under BSD 3-Clause license,
13  * the "License"; You may not use this file except in compliance with the
14  * License. You may obtain a copy of the License at:
15  * opensource.org/licenses/BSD-3-Clause
16  *
17  ******************************************************************************
18  */
19 
20 #if defined(USE_FULL_LL_DRIVER)
21 
22 /* Includes ------------------------------------------------------------------*/
23 #include "stm32f1xx_ll_adc.h"
24 #include "stm32f1xx_ll_bus.h"
25 
26 #ifdef USE_FULL_ASSERT
27  #include "stm32_assert.h"
28 #else
29  #define assert_param(expr) ((void)0U)
30 #endif
31 
32 /** @addtogroup STM32F1xx_LL_Driver
33  * @{
34  */
35 
36 #if defined (ADC1) || defined (ADC2) || defined (ADC3)
37 
38 /** @addtogroup ADC_LL ADC
39  * @{
40  */
41 
42 /* Private types -------------------------------------------------------------*/
43 /* Private variables ---------------------------------------------------------*/
44 /* Private constants ---------------------------------------------------------*/
45 /* Private macros ------------------------------------------------------------*/
46 
47 /** @addtogroup ADC_LL_Private_Macros
48  * @{
49  */
50 
51 /* Check of parameters for configuration of ADC hierarchical scope: */
52 /* common to several ADC instances. */
53 /* Check of parameters for configuration of ADC hierarchical scope: */
54 /* ADC instance. */
55 #define IS_LL_ADC_DATA_ALIGN(__DATA_ALIGN__) \
56  ( ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_RIGHT) \
57  || ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_LEFT) \
58  )
59 
60 #define IS_LL_ADC_SCAN_SELECTION(__SCAN_SELECTION__) \
61  ( ((__SCAN_SELECTION__) == LL_ADC_SEQ_SCAN_DISABLE) \
62  || ((__SCAN_SELECTION__) == LL_ADC_SEQ_SCAN_ENABLE) \
63  )
64 
65 #define IS_LL_ADC_SEQ_SCAN_MODE(__SEQ_SCAN_MODE__) \
66  ( ((__SCAN_MODE__) == LL_ADC_SEQ_SCAN_DISABLE) \
67  || ((__SCAN_MODE__) == LL_ADC_SEQ_SCAN_ENABLE) \
68  )
69 
70 /* Check of parameters for configuration of ADC hierarchical scope: */
71 /* ADC group regular */
72 #if defined(ADC3)
73 #define IS_LL_ADC_REG_TRIG_SOURCE(__ADC_INSTANCE__, __REG_TRIG_SOURCE__) \
74  ((((__ADC_INSTANCE__) == ADC1) || ((__ADC_INSTANCE__) == ADC2)) \
75  ? ( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
76  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3) \
77  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH1) \
78  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH2) \
79  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH2) \
80  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
81  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_CH4) \
82  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
83  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO) \
84  ) \
85  : \
86  ( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
87  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3) \
88  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_CH1) \
89  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH3) \
90  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_CH1) \
91  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO_ADC3) \
92  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM5_CH1) \
93  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM5_CH3) \
94  ) \
95  )
96 #else
97 #if defined (STM32F101xE) || defined (STM32F105xC) || defined (STM32F107xC)
98 #define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
99  ( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
100  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3) \
101  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH1) \
102  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH2) \
103  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH2) \
104  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
105  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_CH4) \
106  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
107  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO) \
108  )
109 #else
110 #define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
111  ( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
112  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3) \
113  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH1) \
114  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH2) \
115  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH2) \
116  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
117  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_CH4) \
118  || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
119  )
120 #endif
121 #endif
122 #define IS_LL_ADC_REG_CONTINUOUS_MODE(__REG_CONTINUOUS_MODE__) \
123  ( ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_SINGLE) \
124  || ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_CONTINUOUS) \
125  )
126 
127 #define IS_LL_ADC_REG_DMA_TRANSFER(__REG_DMA_TRANSFER__) \
128  ( ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_NONE) \
129  || ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_UNLIMITED) \
130  )
131 
132 #define IS_LL_ADC_REG_SEQ_SCAN_LENGTH(__REG_SEQ_SCAN_LENGTH__) \
133  ( ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_DISABLE) \
134  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS) \
135  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS) \
136  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS) \
137  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS) \
138  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS) \
139  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS) \
140  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS) \
141  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS) \
142  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS) \
143  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS) \
144  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS) \
145  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS) \
146  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS) \
147  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS) \
148  || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS) \
149  )
150 
151 #define IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(__REG_SEQ_DISCONT_MODE__) \
152  ( ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_DISABLE) \
153  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_1RANK) \
154  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_2RANKS) \
155  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_3RANKS) \
156  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_4RANKS) \
157  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_5RANKS) \
158  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_6RANKS) \
159  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_7RANKS) \
160  || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_8RANKS) \
161  )
162 
163 /* Check of parameters for configuration of ADC hierarchical scope: */
164 /* ADC group injected */
165 #if defined(ADC3)
166 #define IS_LL_ADC_INJ_TRIG_SOURCE(__ADC_INSTANCE__, __INJ_TRIG_SOURCE__) \
167  ((((__ADC_INSTANCE__) == ADC1) || ((__ADC_INSTANCE__) == ADC2)) \
168  ? ( ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE) \
169  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO) \
170  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4) \
171  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_TRGO) \
172  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_CH1) \
173  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH4) \
174  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_TRGO) \
175  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_EXTI_LINE15) \
176  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH4) \
177  ) \
178  : \
179  ( ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE) \
180  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO) \
181  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4) \
182  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_CH3) \
183  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH2) \
184  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH4_ADC3) \
185  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM5_TRGO) \
186  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM5_CH4) \
187  ) \
188  )
189 #else
190 #if defined (STM32F101xE) || defined (STM32F105xC) || defined (STM32F107xC)
191 #define IS_LL_ADC_INJ_TRIG_SOURCE(__INJ_TRIG_SOURCE__) \
192  ( ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE) \
193  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO) \
194  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4) \
195  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_TRGO) \
196  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_CH1) \
197  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH4) \
198  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_TRGO) \
199  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_EXTI_LINE15) \
200  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH4) \
201  )
202 #else
203 #define IS_LL_ADC_INJ_TRIG_SOURCE(__INJ_TRIG_SOURCE__) \
204  ( ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE) \
205  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO) \
206  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4) \
207  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_TRGO) \
208  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_CH1) \
209  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH4) \
210  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_TRGO) \
211  || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_EXTI_LINE15) \
212  )
213 #endif
214 #endif
215 #define IS_LL_ADC_INJ_TRIG_AUTO(__INJ_TRIG_AUTO__) \
216  ( ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_INDEPENDENT) \
217  || ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_FROM_GRP_REGULAR) \
218  )
219 
220 #define IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(__INJ_SEQ_SCAN_LENGTH__) \
221  ( ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_DISABLE) \
222  || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS) \
223  || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS) \
224  || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS) \
225  )
226 
227 #define IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(__INJ_SEQ_DISCONT_MODE__) \
228  ( ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_DISABLE) \
229  || ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_1RANK) \
230  )
231 
232 #if defined(ADC_MULTIMODE_SUPPORT)
233 /* Check of parameters for configuration of ADC hierarchical scope: */
234 /* multimode. */
235 #define IS_LL_ADC_MULTI_MODE(__MULTI_MODE__) \
236  ( ((__MULTI_MODE__) == LL_ADC_MULTI_INDEPENDENT) \
237  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIMULT) \
238  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTERL_FAST) \
239  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTERL_SLOW) \
240  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_SIMULT) \
241  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_ALTERN) \
242  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM) \
243  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT) \
244  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTFAST_INJ_SIM) \
245  || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTSLOW_INJ_SIM) \
246  )
247 
248 #define IS_LL_ADC_MULTI_MASTER_SLAVE(__MULTI_MASTER_SLAVE__) \
249  ( ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER) \
250  || ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_SLAVE) \
251  || ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER_SLAVE) \
252  )
253 
254 #endif /* ADC_MULTIMODE_SUPPORT */
255 /**
256  * @}
257  */
258 
259 
260 /* Private function prototypes -----------------------------------------------*/
261 
262 /* Exported functions --------------------------------------------------------*/
263 /** @addtogroup ADC_LL_Exported_Functions
264  * @{
265  */
266 
267 /** @addtogroup ADC_LL_EF_Init
268  * @{
269  */
270 
271 /**
272  * @brief De-initialize registers of all ADC instances belonging to
273  * the same ADC common instance to their default reset values.
274  * @param ADCxy_COMMON ADC common instance
275  * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
276  * @retval An ErrorStatus enumeration value:
277  * - SUCCESS: ADC common registers are de-initialized
278  * - ERROR: not applicable
279  */
280 ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON)
281 {
282  /* Check the parameters */
283  assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
284 
285  /* Force reset of ADC clock (core clock) */
286  LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_ADC1);
287 
288  /* Release reset of ADC clock (core clock) */
289  LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_ADC1);
290 
291  return SUCCESS;
292 }
293 
294 /**
295  * @brief Initialize some features of ADC common parameters
296  * (all ADC instances belonging to the same ADC common instance)
297  * and multimode (for devices with several ADC instances available).
298  * @note The setting of ADC common parameters is conditioned to
299  * ADC instances state:
300  * All ADC instances belonging to the same ADC common instance
301  * must be disabled.
302  * @param ADCxy_COMMON ADC common instance
303  * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
304  * @param ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
305  * @retval An ErrorStatus enumeration value:
306  * - SUCCESS: ADC common registers are initialized
307  * - ERROR: ADC common registers are not initialized
308  */
309 ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
310 {
311  ErrorStatus status = SUCCESS;
312 
313  /* Check the parameters */
314  assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
315 #if defined(ADC_MULTIMODE_SUPPORT)
316  assert_param(IS_LL_ADC_MULTI_MODE(ADC_CommonInitStruct->Multimode));
317 #endif /* ADC_MULTIMODE_SUPPORT */
318 
319  /* Note: Hardware constraint (refer to description of functions */
320  /* "LL_ADC_SetCommonXXX()" and "LL_ADC_SetMultiXXX()"): */
321  /* On this STM32 serie, setting of these features is conditioned to */
322  /* ADC state: */
323  /* All ADC instances of the ADC common group must be disabled. */
324  if(__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(ADCxy_COMMON) == 0U)
325  {
326  /* Configuration of ADC hierarchical scope: */
327  /* - common to several ADC */
328  /* (all ADC instances belonging to the same ADC common instance) */
329  /* - multimode (if several ADC instances available on the */
330  /* selected device) */
331  /* - Set ADC multimode configuration */
332  /* - Set ADC multimode DMA transfer */
333  /* - Set ADC multimode: delay between 2 sampling phases */
334 #if defined(ADC_MULTIMODE_SUPPORT)
335  if(ADC_CommonInitStruct->Multimode != LL_ADC_MULTI_INDEPENDENT)
336  {
337  MODIFY_REG(ADCxy_COMMON->CR1,
339  ADC_CommonInitStruct->Multimode
340  );
341  }
342  else
343  {
344  MODIFY_REG(ADCxy_COMMON->CR1,
346  LL_ADC_MULTI_INDEPENDENT
347  );
348  }
349 #endif
350  }
351  else
352  {
353  /* Initialization error: One or several ADC instances belonging to */
354  /* the same ADC common instance are not disabled. */
355  status = ERROR;
356  }
357 
358  return status;
359 }
360 
361 /**
362  * @brief Set each @ref LL_ADC_CommonInitTypeDef field to default value.
363  * @param ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
364  * whose fields will be set to default values.
365  * @retval None
366  */
367 void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
368 {
369  /* Set ADC_CommonInitStruct fields to default values */
370  /* Set fields of ADC common */
371  /* (all ADC instances belonging to the same ADC common instance) */
372 
373 #if defined(ADC_MULTIMODE_SUPPORT)
374  /* Set fields of ADC multimode */
375  ADC_CommonInitStruct->Multimode = LL_ADC_MULTI_INDEPENDENT;
376 #endif /* ADC_MULTIMODE_SUPPORT */
377 }
378 
379 /**
380  * @brief De-initialize registers of the selected ADC instance
381  * to their default reset values.
382  * @note To reset all ADC instances quickly (perform a hard reset),
383  * use function @ref LL_ADC_CommonDeInit().
384  * @param ADCx ADC instance
385  * @retval An ErrorStatus enumeration value:
386  * - SUCCESS: ADC registers are de-initialized
387  * - ERROR: ADC registers are not de-initialized
388  */
389 ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx)
390 {
391  ErrorStatus status = SUCCESS;
392 
393  /* Check the parameters */
395 
396  /* Disable ADC instance if not already disabled. */
397  if(LL_ADC_IsEnabled(ADCx) == 1U)
398  {
399  /* Set ADC group regular trigger source to SW start to ensure to not */
400  /* have an external trigger event occurring during the conversion stop */
401  /* ADC disable process. */
402  LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);
403 
404  /* Set ADC group injected trigger source to SW start to ensure to not */
405  /* have an external trigger event occurring during the conversion stop */
406  /* ADC disable process. */
407  LL_ADC_INJ_SetTriggerSource(ADCx, LL_ADC_INJ_TRIG_SOFTWARE);
408 
409  /* Disable the ADC instance */
410  LL_ADC_Disable(ADCx);
411  }
412 
413  /* Check whether ADC state is compliant with expected state */
414  /* (hardware requirements of bits state to reset registers below) */
415  if(READ_BIT(ADCx->CR2, ADC_CR2_ADON) == 0U)
416  {
417  /* ========== Reset ADC registers ========== */
418  /* Reset register SR */
419  CLEAR_BIT(ADCx->SR,
420  ( LL_ADC_FLAG_STRT
421  | LL_ADC_FLAG_JSTRT
422  | LL_ADC_FLAG_EOS
423  | LL_ADC_FLAG_JEOS
424  | LL_ADC_FLAG_AWD1 )
425  );
426 
427  /* Reset register CR1 */
428  #if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
429 
430  CLEAR_BIT(ADCx->CR1,
435  | ADC_CR1_AWDCH )
436  );
437  #else
438 
439  CLEAR_BIT(ADCx->CR1,
444  );
445  #endif
446 
447  /* Reset register CR2 */
448  CLEAR_BIT(ADCx->CR2,
455  );
456 
457  /* Reset register SMPR1 */
458  CLEAR_BIT(ADCx->SMPR1,
462  );
463 
464  /* Reset register SMPR2 */
465  CLEAR_BIT(ADCx->SMPR2,
470  );
471 
472  /* Reset register JOFR1 */
474  /* Reset register JOFR2 */
476  /* Reset register JOFR3 */
478  /* Reset register JOFR4 */
480 
481  /* Reset register HTR */
482  SET_BIT(ADCx->HTR, ADC_HTR_HT);
483  /* Reset register LTR */
484  CLEAR_BIT(ADCx->LTR, ADC_LTR_LT);
485 
486  /* Reset register SQR1 */
487  CLEAR_BIT(ADCx->SQR1,
488  ( ADC_SQR1_L
489  | ADC_SQR1_SQ16
491  );
492 
493  /* Reset register SQR2 */
494  CLEAR_BIT(ADCx->SQR2,
497  );
498 
499 
500  /* Reset register JSQR */
501  CLEAR_BIT(ADCx->JSQR,
502  ( ADC_JSQR_JL
505  );
506 
507  /* Reset register DR */
508  /* bits in access mode read only, no direct reset applicable */
509 
510  /* Reset registers JDR1, JDR2, JDR3, JDR4 */
511  /* bits in access mode read only, no direct reset applicable */
512 
513  }
514 
515  return status;
516 }
517 
518 /**
519  * @brief Initialize some features of ADC instance.
520  * @note These parameters have an impact on ADC scope: ADC instance.
521  * Affects both group regular and group injected (availability
522  * of ADC group injected depends on STM32 families).
523  * Refer to corresponding unitary functions into
524  * @ref ADC_LL_EF_Configuration_ADC_Instance .
525  * @note The setting of these parameters by function @ref LL_ADC_Init()
526  * is conditioned to ADC state:
527  * ADC instance must be disabled.
528  * This condition is applied to all ADC features, for efficiency
529  * and compatibility over all STM32 families. However, the different
530  * features can be set under different ADC state conditions
531  * (setting possible with ADC enabled without conversion on going,
532  * ADC enabled with conversion on going, ...)
533  * Each feature can be updated afterwards with a unitary function
534  * and potentially with ADC in a different state than disabled,
535  * refer to description of each function for setting
536  * conditioned to ADC state.
537  * @note After using this function, some other features must be configured
538  * using LL unitary functions.
539  * The minimum configuration remaining to be done is:
540  * - Set ADC group regular or group injected sequencer:
541  * map channel on the selected sequencer rank.
542  * Refer to function @ref LL_ADC_REG_SetSequencerRanks().
543  * - Set ADC channel sampling time
544  * Refer to function LL_ADC_SetChannelSamplingTime();
545  * @param ADCx ADC instance
546  * @param ADC_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
547  * @retval An ErrorStatus enumeration value:
548  * - SUCCESS: ADC registers are initialized
549  * - ERROR: ADC registers are not initialized
550  */
551 ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct)
552 {
553  ErrorStatus status = SUCCESS;
554 
555  /* Check the parameters */
557 
558  assert_param(IS_LL_ADC_DATA_ALIGN(ADC_InitStruct->DataAlignment));
559  assert_param(IS_LL_ADC_SCAN_SELECTION(ADC_InitStruct->SequencersScanMode));
560 
561  /* Note: Hardware constraint (refer to description of this function): */
562  /* ADC instance must be disabled. */
563  if(LL_ADC_IsEnabled(ADCx) == 0U)
564  {
565  /* Configuration of ADC hierarchical scope: */
566  /* - ADC instance */
567  /* - Set ADC conversion data alignment */
568  MODIFY_REG(ADCx->CR1,
570  ,
571  ADC_InitStruct->SequencersScanMode
572  );
573 
574  MODIFY_REG(ADCx->CR2,
576  ,
577  ADC_InitStruct->DataAlignment
578  );
579 
580  }
581  else
582  {
583  /* Initialization error: ADC instance is not disabled. */
584  status = ERROR;
585  }
586  return status;
587 }
588 
589 /**
590  * @brief Set each @ref LL_ADC_InitTypeDef field to default value.
591  * @param ADC_InitStruct Pointer to a @ref LL_ADC_InitTypeDef structure
592  * whose fields will be set to default values.
593  * @retval None
594  */
595 void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct)
596 {
597  /* Set ADC_InitStruct fields to default values */
598  /* Set fields of ADC instance */
599  ADC_InitStruct->DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
600 
601  /* Enable scan mode to have a generic behavior with ADC of other */
602  /* STM32 families, without this setting available: */
603  /* ADC group regular sequencer and ADC group injected sequencer depend */
604  /* only of their own configuration. */
605  ADC_InitStruct->SequencersScanMode = LL_ADC_SEQ_SCAN_ENABLE;
606 
607 }
608 
609 /**
610  * @brief Initialize some features of ADC group regular.
611  * @note These parameters have an impact on ADC scope: ADC group regular.
612  * Refer to corresponding unitary functions into
613  * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
614  * (functions with prefix "REG").
615  * @note The setting of these parameters by function @ref LL_ADC_Init()
616  * is conditioned to ADC state:
617  * ADC instance must be disabled.
618  * This condition is applied to all ADC features, for efficiency
619  * and compatibility over all STM32 families. However, the different
620  * features can be set under different ADC state conditions
621  * (setting possible with ADC enabled without conversion on going,
622  * ADC enabled with conversion on going, ...)
623  * Each feature can be updated afterwards with a unitary function
624  * and potentially with ADC in a different state than disabled,
625  * refer to description of each function for setting
626  * conditioned to ADC state.
627  * @note After using this function, other features must be configured
628  * using LL unitary functions.
629  * The minimum configuration remaining to be done is:
630  * - Set ADC group regular or group injected sequencer:
631  * map channel on the selected sequencer rank.
632  * Refer to function @ref LL_ADC_REG_SetSequencerRanks().
633  * - Set ADC channel sampling time
634  * Refer to function LL_ADC_SetChannelSamplingTime();
635  * @param ADCx ADC instance
636  * @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
637  * @retval An ErrorStatus enumeration value:
638  * - SUCCESS: ADC registers are initialized
639  * - ERROR: ADC registers are not initialized
640  */
641 ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
642 {
643  ErrorStatus status = SUCCESS;
644 
645  /* Check the parameters */
647 #if defined(ADC3)
648  assert_param(IS_LL_ADC_REG_TRIG_SOURCE(ADCx, ADC_REG_InitStruct->TriggerSource));
649 #else
650  assert_param(IS_LL_ADC_REG_TRIG_SOURCE(ADC_REG_InitStruct->TriggerSource));
651 #endif
652  assert_param(IS_LL_ADC_REG_SEQ_SCAN_LENGTH(ADC_REG_InitStruct->SequencerLength));
653  if(ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
654  {
655  assert_param(IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(ADC_REG_InitStruct->SequencerDiscont));
656  }
657  assert_param(IS_LL_ADC_REG_CONTINUOUS_MODE(ADC_REG_InitStruct->ContinuousMode));
658  assert_param(IS_LL_ADC_REG_DMA_TRANSFER(ADC_REG_InitStruct->DMATransfer));
659 
660  /* ADC group regular continuous mode and discontinuous mode */
661  /* can not be enabled simultenaeously */
662  assert_param((ADC_REG_InitStruct->ContinuousMode == LL_ADC_REG_CONV_SINGLE)
663  || (ADC_REG_InitStruct->SequencerDiscont == LL_ADC_REG_SEQ_DISCONT_DISABLE));
664 
665  /* Note: Hardware constraint (refer to description of this function): */
666  /* ADC instance must be disabled. */
667  if(LL_ADC_IsEnabled(ADCx) == 0U)
668  {
669  /* Configuration of ADC hierarchical scope: */
670  /* - ADC group regular */
671  /* - Set ADC group regular trigger source */
672  /* - Set ADC group regular sequencer length */
673  /* - Set ADC group regular sequencer discontinuous mode */
674  /* - Set ADC group regular continuous mode */
675  /* - Set ADC group regular conversion data transfer: no transfer or */
676  /* transfer by DMA, and DMA requests mode */
677  /* Note: On this STM32 serie, ADC trigger edge is set when starting */
678  /* ADC conversion. */
679  /* Refer to function @ref LL_ADC_REG_StartConversionExtTrig(). */
680  if(ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
681  {
682  MODIFY_REG(ADCx->CR1,
685  ,
686  ADC_REG_InitStruct->SequencerLength
687  | ADC_REG_InitStruct->SequencerDiscont
688  );
689  }
690  else
691  {
692  MODIFY_REG(ADCx->CR1,
695  ,
696  ADC_REG_InitStruct->SequencerLength
697  | LL_ADC_REG_SEQ_DISCONT_DISABLE
698  );
699  }
700 
701  MODIFY_REG(ADCx->CR2,
703  | ADC_CR2_CONT
704  | ADC_CR2_DMA
705  ,
706  ADC_REG_InitStruct->TriggerSource
707  | ADC_REG_InitStruct->ContinuousMode
708  | ADC_REG_InitStruct->DMATransfer
709  );
710 
711  /* Set ADC group regular sequencer length and scan direction */
712  /* Note: Hardware constraint (refer to description of this function): */
713  /* Note: If ADC instance feature scan mode is disabled */
714  /* (refer to ADC instance initialization structure */
715  /* parameter @ref SequencersScanMode */
716  /* or function @ref LL_ADC_SetSequencersScanMode() ), */
717  /* this parameter is discarded. */
718  LL_ADC_REG_SetSequencerLength(ADCx, ADC_REG_InitStruct->SequencerLength);
719  }
720  else
721  {
722  /* Initialization error: ADC instance is not disabled. */
723  status = ERROR;
724  }
725  return status;
726 }
727 
728 /**
729  * @brief Set each @ref LL_ADC_REG_InitTypeDef field to default value.
730  * @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
731  * whose fields will be set to default values.
732  * @retval None
733  */
734 void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
735 {
736  /* Set ADC_REG_InitStruct fields to default values */
737  /* Set fields of ADC group regular */
738  /* Note: On this STM32 serie, ADC trigger edge is set when starting */
739  /* ADC conversion. */
740  /* Refer to function @ref LL_ADC_REG_StartConversionExtTrig(). */
741  ADC_REG_InitStruct->TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
742  ADC_REG_InitStruct->SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE;
743  ADC_REG_InitStruct->SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
744  ADC_REG_InitStruct->ContinuousMode = LL_ADC_REG_CONV_SINGLE;
745  ADC_REG_InitStruct->DMATransfer = LL_ADC_REG_DMA_TRANSFER_NONE;
746 }
747 
748 /**
749  * @brief Initialize some features of ADC group injected.
750  * @note These parameters have an impact on ADC scope: ADC group injected.
751  * Refer to corresponding unitary functions into
752  * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
753  * (functions with prefix "INJ").
754  * @note The setting of these parameters by function @ref LL_ADC_Init()
755  * is conditioned to ADC state:
756  * ADC instance must be disabled.
757  * This condition is applied to all ADC features, for efficiency
758  * and compatibility over all STM32 families. However, the different
759  * features can be set under different ADC state conditions
760  * (setting possible with ADC enabled without conversion on going,
761  * ADC enabled with conversion on going, ...)
762  * Each feature can be updated afterwards with a unitary function
763  * and potentially with ADC in a different state than disabled,
764  * refer to description of each function for setting
765  * conditioned to ADC state.
766  * @note After using this function, other features must be configured
767  * using LL unitary functions.
768  * The minimum configuration remaining to be done is:
769  * - Set ADC group injected sequencer:
770  * map channel on the selected sequencer rank.
771  * Refer to function @ref LL_ADC_INJ_SetSequencerRanks().
772  * - Set ADC channel sampling time
773  * Refer to function LL_ADC_SetChannelSamplingTime();
774  * @param ADCx ADC instance
775  * @param ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
776  * @retval An ErrorStatus enumeration value:
777  * - SUCCESS: ADC registers are initialized
778  * - ERROR: ADC registers are not initialized
779  */
780 ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
781 {
782  ErrorStatus status = SUCCESS;
783 
784  /* Check the parameters */
786 #if defined(ADC3)
787  assert_param(IS_LL_ADC_INJ_TRIG_SOURCE(ADCx, ADC_INJ_InitStruct->TriggerSource));
788 #else
789  assert_param(IS_LL_ADC_INJ_TRIG_SOURCE(ADC_INJ_InitStruct->TriggerSource));
790 #endif
791  assert_param(IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(ADC_INJ_InitStruct->SequencerLength));
792  if(ADC_INJ_InitStruct->SequencerLength != LL_ADC_INJ_SEQ_SCAN_DISABLE)
793  {
794  assert_param(IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(ADC_INJ_InitStruct->SequencerDiscont));
795  }
796  assert_param(IS_LL_ADC_INJ_TRIG_AUTO(ADC_INJ_InitStruct->TrigAuto));
797 
798  /* Note: Hardware constraint (refer to description of this function): */
799  /* ADC instance must be disabled. */
800  if(LL_ADC_IsEnabled(ADCx) == 0U)
801  {
802  /* Configuration of ADC hierarchical scope: */
803  /* - ADC group injected */
804  /* - Set ADC group injected trigger source */
805  /* - Set ADC group injected sequencer length */
806  /* - Set ADC group injected sequencer discontinuous mode */
807  /* - Set ADC group injected conversion trigger: independent or */
808  /* from ADC group regular */
809  /* Note: On this STM32 serie, ADC trigger edge is set when starting */
810  /* ADC conversion. */
811  /* Refer to function @ref LL_ADC_INJ_StartConversionExtTrig(). */
812  if(ADC_INJ_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
813  {
814  MODIFY_REG(ADCx->CR1,
816  | ADC_CR1_JAUTO
817  ,
818  ADC_INJ_InitStruct->SequencerDiscont
819  | ADC_INJ_InitStruct->TrigAuto
820  );
821  }
822  else
823  {
824  MODIFY_REG(ADCx->CR1,
826  | ADC_CR1_JAUTO
827  ,
828  LL_ADC_REG_SEQ_DISCONT_DISABLE
829  | ADC_INJ_InitStruct->TrigAuto
830  );
831  }
832 
833  MODIFY_REG(ADCx->CR2,
835  ,
836  ADC_INJ_InitStruct->TriggerSource
837  );
838 
839  /* Note: Hardware constraint (refer to description of this function): */
840  /* Note: If ADC instance feature scan mode is disabled */
841  /* (refer to ADC instance initialization structure */
842  /* parameter @ref SequencersScanMode */
843  /* or function @ref LL_ADC_SetSequencersScanMode() ), */
844  /* this parameter is discarded. */
845  LL_ADC_INJ_SetSequencerLength(ADCx, ADC_INJ_InitStruct->SequencerLength);
846  }
847  else
848  {
849  /* Initialization error: ADC instance is not disabled. */
850  status = ERROR;
851  }
852  return status;
853 }
854 
855 /**
856  * @brief Set each @ref LL_ADC_INJ_InitTypeDef field to default value.
857  * @param ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
858  * whose fields will be set to default values.
859  * @retval None
860  */
861 void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
862 {
863  /* Set ADC_INJ_InitStruct fields to default values */
864  /* Set fields of ADC group injected */
865  ADC_INJ_InitStruct->TriggerSource = LL_ADC_INJ_TRIG_SOFTWARE;
866  ADC_INJ_InitStruct->SequencerLength = LL_ADC_INJ_SEQ_SCAN_DISABLE;
867  ADC_INJ_InitStruct->SequencerDiscont = LL_ADC_INJ_SEQ_DISCONT_DISABLE;
868  ADC_INJ_InitStruct->TrigAuto = LL_ADC_INJ_TRIG_INDEPENDENT;
869 }
870 
871 /**
872  * @}
873  */
874 
875 /**
876  * @}
877  */
878 
879 /**
880  * @}
881  */
882 
883 #endif /* ADC1 || ADC2 || ADC3 */
884 
885 /**
886  * @}
887  */
888 
889 #endif /* USE_FULL_LL_DRIVER */
890 
891 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ADC_TypeDef::JOFR4
__IO uint32_t JOFR4
Definition: stm32f103xb.h:154
ADC_TypeDef::JSQR
__IO uint32_t JSQR
Definition: stm32f103xb.h:160
ADC_CR1_AWDSGL
#define ADC_CR1_AWDSGL
Definition: stm32f103xb.h:3326
ERROR
@ ERROR
Definition: stm32f1xx.h:167
ADC_TypeDef::SMPR1
__IO uint32_t SMPR1
Definition: stm32f103xb.h:149
ADC_SMPR1_SMP14
#define ADC_SMPR1_SMP14
Definition: stm32f103xb.h:3445
ADC_JOFR2_JOFFSET2
#define ADC_JOFR2_JOFFSET2
Definition: stm32f103xb.h:3550
ADC_SQR2_SQ10
#define ADC_SQR2_SQ10
Definition: stm32f103xb.h:3647
ADC_HTR_HT
#define ADC_HTR_HT
Definition: stm32f103xb.h:3565
ADC_TypeDef::SMPR2
__IO uint32_t SMPR2
Definition: stm32f103xb.h:150
ADC_SQR2_SQ12
#define ADC_SQR2_SQ12
Definition: stm32f103xb.h:3665
ADC_SQR2_SQ9
#define ADC_SQR2_SQ9
Definition: stm32f103xb.h:3638
ADC_TypeDef::SQR1
__IO uint32_t SQR1
Definition: stm32f103xb.h:157
ADC_TypeDef::LTR
__IO uint32_t LTR
Definition: stm32f103xb.h:156
ADC_SMPR2_SMP2
#define ADC_SMPR2_SMP2
Definition: stm32f103xb.h:3488
stm32f1xx_ll_adc.h
Header file of ADC LL module.
ADC_CR2_CAL
#define ADC_CR2_CAL
Definition: stm32f103xb.h:3372
ADC_TypeDef::JOFR3
__IO uint32_t JOFR3
Definition: stm32f103xb.h:153
ADC_TypeDef::HTR
__IO uint32_t HTR
Definition: stm32f103xb.h:155
ADC_CR2_SWSTART
#define ADC_CR2_SWSTART
Definition: stm32f103xb.h:3409
READ_BIT
#define READ_BIT(REG, BIT)
Definition: stm32f1xx.h:182
ADC_CR1_AWDCH
#define ADC_CR1_AWDCH
Definition: stm32f103xb.h:3305
ADC_CR1_JEOCIE
#define ADC_CR1_JEOCIE
Definition: stm32f103xb.h:3361
ADC_CR1_JDISCEN
#define ADC_CR1_JDISCEN
Definition: stm32f103xb.h:3335
stm32f1xx_ll_bus.h
Header file of BUS LL module.
ADC_CR1_EOCIE
#define ADC_CR1_EOCIE
Definition: stm32f103xb.h:3360
ADC_SQR2_SQ8
#define ADC_SQR2_SQ8
Definition: stm32f103xb.h:3629
ADC_Common_TypeDef::CR1
__IO uint32_t CR1
Definition: stm32f103xb.h:171
ADC_TypeDef::JOFR1
__IO uint32_t JOFR1
Definition: stm32f103xb.h:151
ADC_SMPR2_SMP8
#define ADC_SMPR2_SMP8
Definition: stm32f103xb.h:3530
ADC_CR1_AWDEN
#define ADC_CR1_AWDEN
Definition: stm32f103xb.h:3357
ADC_CR1_DISCEN
#define ADC_CR1_DISCEN
Definition: stm32f103xb.h:3332
ADC_CR2_DMA
#define ADC_CR2_DMA
Definition: stm32f103xb.h:3378
assert_param
#define assert_param(expr)
Definition: stm32_assert.h:44
ADC_JSQR_JSQ3
#define ADC_JSQR_JSQ3
Definition: stm32f103xb.h:3748
ADC_SMPR1_SMP16
#define ADC_SMPR1_SMP16
Definition: stm32f103xb.h:3459
ADC_CR2_ADON
#define ADC_CR2_ADON
Definition: stm32f103xb.h:3366
ADC_CR1_DISCNUM
#define ADC_CR1_DISCNUM
Definition: stm32f103xb.h:3339
stm32_assert.h
STM32 assert file.
ADC_JSQR_JSQ2
#define ADC_JSQR_JSQ2
Definition: stm32f103xb.h:3739
ADC_TypeDef::CR2
__IO uint32_t CR2
Definition: stm32f103xb.h:148
ADC_SMPR2_SMP7
#define ADC_SMPR2_SMP7
Definition: stm32f103xb.h:3523
ADC_JOFR4_JOFFSET4
#define ADC_JOFR4_JOFFSET4
Definition: stm32f103xb.h:3560
MODIFY_REG
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
Definition: stm32f1xx.h:190
ADC_SMPR1_SMP11
#define ADC_SMPR1_SMP11
Definition: stm32f103xb.h:3424
ADC_TypeDef::SR
__IO uint32_t SR
Definition: stm32f103xb.h:146
ADC_SMPR2_SMP0
#define ADC_SMPR2_SMP0
Definition: stm32f103xb.h:3474
ADC_SQR1_L
#define ADC_SQR1_L
Definition: stm32f103xb.h:3611
ADC_JOFR1_JOFFSET1
#define ADC_JOFR1_JOFFSET1
Definition: stm32f103xb.h:3545
ADC_SMPR2_SMP9
#define ADC_SMPR2_SMP9
Definition: stm32f103xb.h:3537
ADC_TypeDef
Analog to Digital Converter
Definition: stm32f103xb.h:144
ADC_SQR1_SQ14
#define ADC_SQR1_SQ14
Definition: stm32f103xb.h:3584
IS_ADC_COMMON_INSTANCE
#define IS_ADC_COMMON_INSTANCE(INSTANCE)
Definition: stm32f103xb.h:9884
ADC_CR2_EXTSEL
#define ADC_CR2_EXTSEL
Definition: stm32f103xb.h:3396
ADC_JSQR_JL
#define ADC_JSQR_JL
Definition: stm32f103xb.h:3766
ADC_CR1_JAWDEN
#define ADC_CR1_JAWDEN
Definition: stm32f103xb.h:3354
ADC_SMPR1_SMP17
#define ADC_SMPR1_SMP17
Definition: stm32f103xb.h:3466
ADC_SQR2_SQ11
#define ADC_SQR2_SQ11
Definition: stm32f103xb.h:3656
ADC_TypeDef::SQR2
__IO uint32_t SQR2
Definition: stm32f103xb.h:158
ADC_SMPR2_SMP6
#define ADC_SMPR2_SMP6
Definition: stm32f103xb.h:3516
ADC_SQR1_SQ13
#define ADC_SQR1_SQ13
Definition: stm32f103xb.h:3575
ADC_Common_TypeDef
Definition: stm32f103xb.h:168
ADC_JOFR3_JOFFSET3
#define ADC_JOFR3_JOFFSET3
Definition: stm32f103xb.h:3555
ADC_CR2_RSTCAL
#define ADC_CR2_RSTCAL
Definition: stm32f103xb.h:3375
ADC_SQR2_SQ7
#define ADC_SQR2_SQ7
Definition: stm32f103xb.h:3620
ADC_SQR1_SQ15
#define ADC_SQR1_SQ15
Definition: stm32f103xb.h:3593
ADC_SMPR2_SMP1
#define ADC_SMPR2_SMP1
Definition: stm32f103xb.h:3481
ADC_SMPR1_SMP15
#define ADC_SMPR1_SMP15
Definition: stm32f103xb.h:3452
ADC_CR1_AWDIE
#define ADC_CR1_AWDIE
Definition: stm32f103xb.h:3317
ADC_SMPR1_SMP10
#define ADC_SMPR1_SMP10
Definition: stm32f103xb.h:3417
ADC_SMPR2_SMP5
#define ADC_SMPR2_SMP5
Definition: stm32f103xb.h:3509
ADC_TypeDef::CR1
__IO uint32_t CR1
Definition: stm32f103xb.h:147
ADC_SMPR2_SMP4
#define ADC_SMPR2_SMP4
Definition: stm32f103xb.h:3502
ADC_SQR1_SQ16
#define ADC_SQR1_SQ16
Definition: stm32f103xb.h:3602
ADC_CR2_JEXTSEL
#define ADC_CR2_JEXTSEL
Definition: stm32f103xb.h:3385
ADC_JSQR_JSQ4
#define ADC_JSQR_JSQ4
Definition: stm32f103xb.h:3757
ADC_LTR_LT
#define ADC_LTR_LT
Definition: stm32f103xb.h:3570
SUCCESS
@ SUCCESS
Definition: stm32f1xx.h:166
ADC_CR1_SCAN
#define ADC_CR1_SCAN
Definition: stm32f103xb.h:3323
ADC_CR1_JAUTO
#define ADC_CR1_JAUTO
Definition: stm32f103xb.h:3329
ADC_SMPR2_SMP3
#define ADC_SMPR2_SMP3
Definition: stm32f103xb.h:3495
SET_BIT
#define SET_BIT(REG, BIT)
Definition: stm32f1xx.h:178
ADC_CR2_JSWSTART
#define ADC_CR2_JSWSTART
Definition: stm32f103xb.h:3406
ADC_CR2_JEXTTRIG
#define ADC_CR2_JEXTTRIG
Definition: stm32f103xb.h:3392
CLEAR_BIT
#define CLEAR_BIT(REG, BIT)
Definition: stm32f1xx.h:180
ADC_SMPR1_SMP13
#define ADC_SMPR1_SMP13
Definition: stm32f103xb.h:3438
ADC_CR2_CONT
#define ADC_CR2_CONT
Definition: stm32f103xb.h:3369
IS_ADC_ALL_INSTANCE
#define IS_ADC_ALL_INSTANCE(INSTANCE)
Definition: stm32f103xb.h:9881
ADC_CR2_TSVREFE
#define ADC_CR2_TSVREFE
Definition: stm32f103xb.h:3412
ErrorStatus
ErrorStatus
Definition: stm32f1xx.h:164
ADC_CR2_EXTTRIG
#define ADC_CR2_EXTTRIG
Definition: stm32f103xb.h:3403
ADC_CR2_ALIGN
#define ADC_CR2_ALIGN
Definition: stm32f103xb.h:3381
ADC_SMPR1_SMP12
#define ADC_SMPR1_SMP12
Definition: stm32f103xb.h:3431
ADC_TypeDef::JOFR2
__IO uint32_t JOFR2
Definition: stm32f103xb.h:152
ADC_CR1_DUALMOD
#define ADC_CR1_DUALMOD
Definition: stm32f103xb.h:3346
ADC_JSQR_JSQ1
#define ADC_JSQR_JSQ1
Definition: stm32f103xb.h:3730