Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief Header file of ADC HAL extension module. |
5 | * @brief Header file of ADC HAL extension module. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * 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, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 14 | * this list of conditions and the following disclaimer. |
- | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 20 | * without specific prior written permission. |
- | |
| 21 | * |
- | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 32 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| 35 | 19 | ||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Line 68... | Line 52... | ||
| 68 | * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv') |
52 | * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv') |
| 69 | * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group. |
53 | * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group. |
| 70 | */ |
54 | */ |
| 71 | typedef struct |
55 | typedef struct |
| 72 | { |
56 | { |
| 73 | uint32_t InjectedChannel; /*!< Selection of ADC channel to configure |
57 | uint32_t InjectedChannel; /*!< Selection of ADC channel to configure |
| 74 | This parameter can be a value of @ref ADC_channels |
58 | This parameter can be a value of @ref ADC_channels |
| 75 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. |
59 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. |
| 76 | Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor) |
60 | Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor) |
| 77 | Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection trigger. |
61 | Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection trigger. |
| 78 | It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel. |
62 | It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel. |
| 79 | Refer to errata sheet of these devices for more details. */ |
63 | Refer to errata sheet of these devices for more details. */ |
| 80 | uint32_t InjectedRank; /*!< Rank in the injected group sequencer |
64 | uint32_t InjectedRank; /*!< Rank in the injected group sequencer |
| 81 | This parameter must be a value of @ref ADCEx_injected_rank |
65 | This parameter must be a value of @ref ADCEx_injected_rank |
| 82 | Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */ |
66 | Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */ |
| 83 | uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel. |
67 | uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel. |
| 84 | Unit: ADC clock cycles |
68 | Unit: ADC clock cycles |
| 85 | Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits). |
69 | Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits). |
| 86 | This parameter can be a value of @ref ADC_sampling_times |
70 | This parameter can be a value of @ref ADC_sampling_times |
| 87 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
71 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
| 88 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
72 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
| 89 | Note: In case of usage of internal measurement channels (VrefInt/TempSensor), |
73 | Note: In case of usage of internal measurement channels (VrefInt/TempSensor), |
| 90 | sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting) |
74 | sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting) |
| 91 | Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 5us to 17.1us min). */ |
75 | Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 5us to 17.1us min). */ |
| 92 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only). |
76 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only). |
| 93 | Offset value must be a positive number. |
77 | Offset value must be a positive number. |
| 94 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), |
78 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), |
| 95 | this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */ |
79 | this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */ |
| 96 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
80 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
| 97 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
81 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
| 98 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
82 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
| 99 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
83 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
| 100 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
84 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
| 101 | uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
85 | FunctionalState InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts). |
| 102 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
86 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
| 103 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
87 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
| 104 | This parameter can be set to ENABLE or DISABLE. |
88 | This parameter can be set to ENABLE or DISABLE. |
| 105 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
89 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
| 106 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
90 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
| 107 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
91 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
| 108 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
92 | FunctionalState AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
| 109 | This parameter can be set to ENABLE or DISABLE. |
93 | This parameter can be set to ENABLE or DISABLE. |
| 110 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
94 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
| 111 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
95 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
| 112 | 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. |
96 | 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. |
| 113 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
97 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
| 114 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
98 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
| 115 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
99 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
| 116 | uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group. |
100 | uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group. |
| 117 | If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled. |
101 | If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled. |
| 118 | If set to external trigger source, triggering is on event rising edge. |
102 | If set to external trigger source, triggering is on event rising edge. |
| 119 | This parameter can be a value of @ref ADCEx_External_trigger_source_Injected |
103 | This parameter can be a value of @ref ADCEx_External_trigger_source_Injected |
| 120 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
104 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
| 121 | If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) |
105 | If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) |
| 122 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
106 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
| 123 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
107 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
| 124 | }ADC_InjectionConfTypeDef; |
108 | }ADC_InjectionConfTypeDef; |
| 125 | 109 | ||
| 126 | #if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG) |
110 | #if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG) |
| 127 | /** |
111 | /** |
| 128 | * @brief Structure definition of ADC multimode |
112 | * @brief Structure definition of ADC multimode |