Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 28 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32l1xx_hal_adc_ex.h |
3 | * @file stm32l1xx_hal_adc_ex.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @version V1.2.0 |
- | |
6 | * @date 01-July-2016 |
- | |
7 | * @brief Header file of ADC HAL Extension module. |
5 | * @brief Header file of ADC HAL Extension module. |
8 | ****************************************************************************** |
6 | ****************************************************************************** |
9 | * @attention |
7 | * @attention |
10 | * |
8 | * |
11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
- | 10 | * All rights reserved.</center></h2> |
|
12 | * |
11 | * |
13 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
14 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
15 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
16 | * this list of conditions and the following disclaimer. |
- | |
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
18 | * this list of conditions and the following disclaimer in the documentation |
- | |
19 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
21 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
22 | * without specific prior written permission. |
- | |
23 | * |
- | |
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
34 | * |
16 | * |
35 | ****************************************************************************** |
17 | ****************************************************************************** |
36 | */ |
18 | */ |
37 | 19 | ||
38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Line 95... | Line 77... | ||
95 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
77 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
96 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
78 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
97 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
79 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
98 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
80 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
99 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
81 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
100 | uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
82 | FunctionalState InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
101 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
83 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
102 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
84 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
103 | This parameter can be set to ENABLE or DISABLE. |
85 | This parameter can be set to ENABLE or DISABLE. |
104 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
86 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
105 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
87 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
106 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
88 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
107 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
89 | FunctionalState AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
108 | This parameter can be set to ENABLE or DISABLE. |
90 | This parameter can be set to ENABLE or DISABLE. |
109 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
91 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
110 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
92 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
111 | Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete. |
93 | Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete. |
112 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
94 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
Line 138... | Line 120... | ||
138 | */ |
120 | */ |
139 | 121 | ||
140 | /** @defgroup ADCEx_injected_rank ADCEx rank into injected group |
122 | /** @defgroup ADCEx_injected_rank ADCEx rank into injected group |
141 | * @{ |
123 | * @{ |
142 | */ |
124 | */ |
143 | #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) |
125 | #define ADC_INJECTED_RANK_1 (0x00000001U) |
144 | #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) |
126 | #define ADC_INJECTED_RANK_2 (0x00000002U) |
145 | #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) |
127 | #define ADC_INJECTED_RANK_3 (0x00000003U) |
146 | #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) |
128 | #define ADC_INJECTED_RANK_4 (0x00000004U) |
147 | /** |
129 | /** |
148 | * @} |
130 | * @} |
149 | */ |
131 | */ |
150 | 132 | ||
151 | /** @defgroup ADCEx_External_trigger_edge_Injected ADCEx external trigger enable for injected group |
133 | /** @defgroup ADCEx_External_trigger_edge_Injected ADCEx external trigger enable for injected group |
152 | * @{ |
134 | * @{ |
153 | */ |
135 | */ |
154 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000) |
136 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE (0x00000000U) |
155 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0) |
137 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0) |
156 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1) |
138 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1) |
157 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN) |
139 | #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN) |
158 | /** |
140 | /** |
159 | * @} |
141 | * @} |
Line 173... | Line 155... | ||
173 | #define ADC_EXTERNALTRIGINJECCONV_T7_TRGO ADC_EXTERNALTRIGINJEC_T7_TRGO |
155 | #define ADC_EXTERNALTRIGINJECCONV_T7_TRGO ADC_EXTERNALTRIGINJEC_T7_TRGO |
174 | #define ADC_EXTERNALTRIGINJECCONV_T9_CC1 ADC_EXTERNALTRIGINJEC_T9_CC1 |
156 | #define ADC_EXTERNALTRIGINJECCONV_T9_CC1 ADC_EXTERNALTRIGINJEC_T9_CC1 |
175 | #define ADC_EXTERNALTRIGINJECCONV_T9_TRGO ADC_EXTERNALTRIGINJEC_T9_TRGO |
157 | #define ADC_EXTERNALTRIGINJECCONV_T9_TRGO ADC_EXTERNALTRIGINJEC_T9_TRGO |
176 | #define ADC_EXTERNALTRIGINJECCONV_T10_CC1 ADC_EXTERNALTRIGINJEC_T10_CC1 |
158 | #define ADC_EXTERNALTRIGINJECCONV_T10_CC1 ADC_EXTERNALTRIGINJEC_T10_CC1 |
177 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC_EXTERNALTRIGINJEC_EXT_IT15 |
159 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC_EXTERNALTRIGINJEC_EXT_IT15 |
178 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000010) |
160 | #define ADC_INJECTED_SOFTWARE_START (0x00000010U) |
179 | /** |
161 | /** |
180 | * @} |
162 | * @} |
181 | */ |
163 | */ |
182 | 164 | ||
183 | /** |
165 | /** |
Line 195... | Line 177... | ||
195 | * @{ |
177 | * @{ |
196 | */ |
178 | */ |
197 | 179 | ||
198 | /* List of external triggers of injected group for ADC1: */ |
180 | /* List of external triggers of injected group for ADC1: */ |
199 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
181 | /* (used internally by HAL driver. To not use into HAL structure parameters) */ |
200 | #define ADC_EXTERNALTRIGINJEC_T9_CC1 ((uint32_t) 0x00000000) |
182 | #define ADC_EXTERNALTRIGINJEC_T9_CC1 (0x00000000U) |
201 | #define ADC_EXTERNALTRIGINJEC_T9_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_0)) |
183 | #define ADC_EXTERNALTRIGINJEC_T9_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_0)) |
202 | #define ADC_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_1 )) |
184 | #define ADC_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_1 )) |
203 | #define ADC_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)( ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
185 | #define ADC_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)( ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
204 | #define ADC_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)( ADC_CR2_JEXTSEL_2 )) |
186 | #define ADC_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)( ADC_CR2_JEXTSEL_2 )) |
205 | #define ADC_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
187 | #define ADC_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
Line 331... | Line 313... | ||
331 | #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
313 | #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
332 | #define ADC_SMPR0(_SAMPLETIME_, _CHANNELNB_) \ |
314 | #define ADC_SMPR0(_SAMPLETIME_, _CHANNELNB_) \ |
333 | ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 30))) |
315 | ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 30))) |
334 | #else |
316 | #else |
335 | #define ADC_SMPR0(_SAMPLETIME_, _CHANNELNB_) \ |
317 | #define ADC_SMPR0(_SAMPLETIME_, _CHANNELNB_) \ |
336 | ((uint32_t)0x00000000) |
318 | (0x00000000U) |
337 | #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ |
319 | #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ |
338 | 320 | ||
339 | #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
321 | #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
340 | /** |
322 | /** |
341 | * @brief Set the ADC's sample time for channel numbers between 20 and 29. |
323 | * @brief Set the ADC's sample time for channel numbers between 20 and 29. |
Line 515... | Line 497... | ||
515 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
497 | ((REGTRIG) == ADC_SOFTWARE_START) ) |
516 | 498 | ||
517 | /** @defgroup ADCEx_injected_nb_conv_verification ADCEx injected nb conv verification |
499 | /** @defgroup ADCEx_injected_nb_conv_verification ADCEx injected nb conv verification |
518 | * @{ |
500 | * @{ |
519 | */ |
501 | */ |
520 | #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4))) |
502 | #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= (1U)) && ((LENGTH) <= (4U))) |
521 | /** |
503 | /** |
522 | * @} |
504 | * @} |
523 | */ |
505 | */ |
524 | 506 | ||
525 | /** |
507 | /** |