SPKT
Dependencies: F746_GUI SD_PlayerSkeleton F746_SAI_IO
SRC_STM32F7/targets/cmsis/TARGET_STM/TARGET_STM32F7/stm32f7xx_hal_adc_ex.h@0:8ede47d38d10, 2019-06-04 (annotated)
- Committer:
- phungductung
- Date:
- Tue Jun 04 21:37:21 2019 +0000
- Revision:
- 0:8ede47d38d10
SPKT
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
phungductung | 0:8ede47d38d10 | 1 | /** |
phungductung | 0:8ede47d38d10 | 2 | ****************************************************************************** |
phungductung | 0:8ede47d38d10 | 3 | * @file stm32f7xx_hal_adc.h |
phungductung | 0:8ede47d38d10 | 4 | * @author MCD Application Team |
phungductung | 0:8ede47d38d10 | 5 | * @version V1.0.4 |
phungductung | 0:8ede47d38d10 | 6 | * @date 09-December-2015 |
phungductung | 0:8ede47d38d10 | 7 | * @brief Header file of ADC HAL module. |
phungductung | 0:8ede47d38d10 | 8 | ****************************************************************************** |
phungductung | 0:8ede47d38d10 | 9 | * @attention |
phungductung | 0:8ede47d38d10 | 10 | * |
phungductung | 0:8ede47d38d10 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
phungductung | 0:8ede47d38d10 | 12 | * |
phungductung | 0:8ede47d38d10 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
phungductung | 0:8ede47d38d10 | 14 | * are permitted provided that the following conditions are met: |
phungductung | 0:8ede47d38d10 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
phungductung | 0:8ede47d38d10 | 16 | * this list of conditions and the following disclaimer. |
phungductung | 0:8ede47d38d10 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
phungductung | 0:8ede47d38d10 | 18 | * this list of conditions and the following disclaimer in the documentation |
phungductung | 0:8ede47d38d10 | 19 | * and/or other materials provided with the distribution. |
phungductung | 0:8ede47d38d10 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
phungductung | 0:8ede47d38d10 | 21 | * may be used to endorse or promote products derived from this software |
phungductung | 0:8ede47d38d10 | 22 | * without specific prior written permission. |
phungductung | 0:8ede47d38d10 | 23 | * |
phungductung | 0:8ede47d38d10 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
phungductung | 0:8ede47d38d10 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
phungductung | 0:8ede47d38d10 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
phungductung | 0:8ede47d38d10 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
phungductung | 0:8ede47d38d10 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
phungductung | 0:8ede47d38d10 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
phungductung | 0:8ede47d38d10 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
phungductung | 0:8ede47d38d10 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
phungductung | 0:8ede47d38d10 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
phungductung | 0:8ede47d38d10 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
phungductung | 0:8ede47d38d10 | 34 | * |
phungductung | 0:8ede47d38d10 | 35 | ****************************************************************************** |
phungductung | 0:8ede47d38d10 | 36 | */ |
phungductung | 0:8ede47d38d10 | 37 | |
phungductung | 0:8ede47d38d10 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 39 | #ifndef __STM32F7xx_ADC_EX_H |
phungductung | 0:8ede47d38d10 | 40 | #define __STM32F7xx_ADC_EX_H |
phungductung | 0:8ede47d38d10 | 41 | |
phungductung | 0:8ede47d38d10 | 42 | #ifdef __cplusplus |
phungductung | 0:8ede47d38d10 | 43 | extern "C" { |
phungductung | 0:8ede47d38d10 | 44 | #endif |
phungductung | 0:8ede47d38d10 | 45 | |
phungductung | 0:8ede47d38d10 | 46 | /* Includes ------------------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 47 | #include "stm32f7xx_hal_def.h" |
phungductung | 0:8ede47d38d10 | 48 | |
phungductung | 0:8ede47d38d10 | 49 | /** @addtogroup STM32F7xx_HAL_Driver |
phungductung | 0:8ede47d38d10 | 50 | * @{ |
phungductung | 0:8ede47d38d10 | 51 | */ |
phungductung | 0:8ede47d38d10 | 52 | |
phungductung | 0:8ede47d38d10 | 53 | /** @addtogroup ADCEx |
phungductung | 0:8ede47d38d10 | 54 | * @{ |
phungductung | 0:8ede47d38d10 | 55 | */ |
phungductung | 0:8ede47d38d10 | 56 | |
phungductung | 0:8ede47d38d10 | 57 | /* Exported types ------------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 58 | /** @defgroup ADCEx_Exported_Types ADC Exported Types |
phungductung | 0:8ede47d38d10 | 59 | * @{ |
phungductung | 0:8ede47d38d10 | 60 | */ |
phungductung | 0:8ede47d38d10 | 61 | |
phungductung | 0:8ede47d38d10 | 62 | /** |
phungductung | 0:8ede47d38d10 | 63 | * @brief ADC Configuration injected Channel structure definition |
phungductung | 0:8ede47d38d10 | 64 | * @note Parameters of this structure are shared within 2 scopes: |
phungductung | 0:8ede47d38d10 | 65 | * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime, InjectedOffset |
phungductung | 0:8ede47d38d10 | 66 | * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode, |
phungductung | 0:8ede47d38d10 | 67 | * AutoInjectedConv, ExternalTrigInjecConvEdge, ExternalTrigInjecConv. |
phungductung | 0:8ede47d38d10 | 68 | * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state. |
phungductung | 0:8ede47d38d10 | 69 | * ADC state can be either: |
phungductung | 0:8ede47d38d10 | 70 | * - For all parameters: ADC disabled |
phungductung | 0:8ede47d38d10 | 71 | * - For all except parameters 'InjectedDiscontinuousConvMode' and 'AutoInjectedConv': ADC enabled without conversion on going on injected group. |
phungductung | 0:8ede47d38d10 | 72 | * - For parameters 'ExternalTrigInjecConv' and 'ExternalTrigInjecConvEdge': ADC enabled, even with conversion on going on injected group. |
phungductung | 0:8ede47d38d10 | 73 | */ |
phungductung | 0:8ede47d38d10 | 74 | typedef struct |
phungductung | 0:8ede47d38d10 | 75 | { |
phungductung | 0:8ede47d38d10 | 76 | uint32_t InjectedChannel; /*!< Selection of ADC channel to configure |
phungductung | 0:8ede47d38d10 | 77 | This parameter can be a value of @ref ADC_channels |
phungductung | 0:8ede47d38d10 | 78 | Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */ |
phungductung | 0:8ede47d38d10 | 79 | uint32_t InjectedRank; /*!< Rank in the injected group sequencer |
phungductung | 0:8ede47d38d10 | 80 | This parameter must be a value of @ref ADCEx_injected_channel_selection |
phungductung | 0:8ede47d38d10 | 81 | 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) */ |
phungductung | 0:8ede47d38d10 | 82 | uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel. |
phungductung | 0:8ede47d38d10 | 83 | Unit: ADC clock cycles |
phungductung | 0:8ede47d38d10 | 84 | Conversion time is the addition of sampling time and processing time (12 ADC clock cycles at ADC resolution 12 bits, 11 cycles at 10 bits, 9 cycles at 8 bits, 7 cycles at 6 bits). |
phungductung | 0:8ede47d38d10 | 85 | This parameter can be a value of @ref ADC_sampling_times |
phungductung | 0:8ede47d38d10 | 86 | Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups. |
phungductung | 0:8ede47d38d10 | 87 | If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting. |
phungductung | 0:8ede47d38d10 | 88 | Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor), |
phungductung | 0:8ede47d38d10 | 89 | sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting) |
phungductung | 0:8ede47d38d10 | 90 | Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 4us min). */ |
phungductung | 0:8ede47d38d10 | 91 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only). |
phungductung | 0:8ede47d38d10 | 92 | Offset value must be a positive number. |
phungductung | 0:8ede47d38d10 | 93 | Depending of ADC resolution selected (12, 10, 8 or 6 bits), |
phungductung | 0:8ede47d38d10 | 94 | this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */ |
phungductung | 0:8ede47d38d10 | 95 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer. |
phungductung | 0:8ede47d38d10 | 96 | To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled. |
phungductung | 0:8ede47d38d10 | 97 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. |
phungductung | 0:8ede47d38d10 | 98 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
phungductung | 0:8ede47d38d10 | 99 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
phungductung | 0:8ede47d38d10 | 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). |
phungductung | 0:8ede47d38d10 | 101 | Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded. |
phungductung | 0:8ede47d38d10 | 102 | Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded. |
phungductung | 0:8ede47d38d10 | 103 | This parameter can be set to ENABLE or DISABLE. |
phungductung | 0:8ede47d38d10 | 104 | Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one. |
phungductung | 0:8ede47d38d10 | 105 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
phungductung | 0:8ede47d38d10 | 106 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
phungductung | 0:8ede47d38d10 | 107 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one |
phungductung | 0:8ede47d38d10 | 108 | This parameter can be set to ENABLE or DISABLE. |
phungductung | 0:8ede47d38d10 | 109 | Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE) |
phungductung | 0:8ede47d38d10 | 110 | Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START) |
phungductung | 0:8ede47d38d10 | 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. |
phungductung | 0:8ede47d38d10 | 112 | To maintain JAUTO always enabled, DMA must be configured in circular mode. |
phungductung | 0:8ede47d38d10 | 113 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
phungductung | 0:8ede47d38d10 | 114 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
phungductung | 0:8ede47d38d10 | 115 | uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group. |
phungductung | 0:8ede47d38d10 | 116 | If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled. |
phungductung | 0:8ede47d38d10 | 117 | If set to external trigger source, triggering is on event rising edge. |
phungductung | 0:8ede47d38d10 | 118 | This parameter can be a value of @ref ADCEx_External_trigger_Source_Injected |
phungductung | 0:8ede47d38d10 | 119 | Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). |
phungductung | 0:8ede47d38d10 | 120 | 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) |
phungductung | 0:8ede47d38d10 | 121 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
phungductung | 0:8ede47d38d10 | 122 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
phungductung | 0:8ede47d38d10 | 123 | uint32_t ExternalTrigInjecConvEdge; /*!< Selects the external trigger edge of injected group. |
phungductung | 0:8ede47d38d10 | 124 | This parameter can be a value of @ref ADCEx_External_trigger_edge_Injected. |
phungductung | 0:8ede47d38d10 | 125 | If trigger is set to ADC_INJECTED_SOFTWARE_START, this parameter is discarded. |
phungductung | 0:8ede47d38d10 | 126 | Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to |
phungductung | 0:8ede47d38d10 | 127 | configure a channel on injected group can impact the configuration of other channels previously set. */ |
phungductung | 0:8ede47d38d10 | 128 | }ADC_InjectionConfTypeDef; |
phungductung | 0:8ede47d38d10 | 129 | /** |
phungductung | 0:8ede47d38d10 | 130 | * @} |
phungductung | 0:8ede47d38d10 | 131 | */ |
phungductung | 0:8ede47d38d10 | 132 | |
phungductung | 0:8ede47d38d10 | 133 | /** |
phungductung | 0:8ede47d38d10 | 134 | * @brief ADC Configuration multi-mode structure definition |
phungductung | 0:8ede47d38d10 | 135 | */ |
phungductung | 0:8ede47d38d10 | 136 | typedef struct |
phungductung | 0:8ede47d38d10 | 137 | { |
phungductung | 0:8ede47d38d10 | 138 | uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode. |
phungductung | 0:8ede47d38d10 | 139 | This parameter can be a value of @ref ADCEx_Common_mode */ |
phungductung | 0:8ede47d38d10 | 140 | uint32_t DMAAccessMode; /*!< Configures the Direct memory access mode for multi ADC mode. |
phungductung | 0:8ede47d38d10 | 141 | This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multi_mode */ |
phungductung | 0:8ede47d38d10 | 142 | uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases. |
phungductung | 0:8ede47d38d10 | 143 | This parameter can be a value of @ref ADC_delay_between_2_sampling_phases */ |
phungductung | 0:8ede47d38d10 | 144 | }ADC_MultiModeTypeDef; |
phungductung | 0:8ede47d38d10 | 145 | |
phungductung | 0:8ede47d38d10 | 146 | /** |
phungductung | 0:8ede47d38d10 | 147 | * @} |
phungductung | 0:8ede47d38d10 | 148 | */ |
phungductung | 0:8ede47d38d10 | 149 | |
phungductung | 0:8ede47d38d10 | 150 | /* Exported constants --------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 151 | /** @defgroup ADCEx_Exported_Constants ADC Exported Constants |
phungductung | 0:8ede47d38d10 | 152 | * @{ |
phungductung | 0:8ede47d38d10 | 153 | */ |
phungductung | 0:8ede47d38d10 | 154 | |
phungductung | 0:8ede47d38d10 | 155 | /** @defgroup ADCEx_Common_mode ADC Common Mode |
phungductung | 0:8ede47d38d10 | 156 | * @{ |
phungductung | 0:8ede47d38d10 | 157 | */ |
phungductung | 0:8ede47d38d10 | 158 | #define ADC_MODE_INDEPENDENT ((uint32_t)0x00000000) |
phungductung | 0:8ede47d38d10 | 159 | #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)ADC_CCR_MULTI_0) |
phungductung | 0:8ede47d38d10 | 160 | #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)ADC_CCR_MULTI_1) |
phungductung | 0:8ede47d38d10 | 161 | #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 162 | #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1)) |
phungductung | 0:8ede47d38d10 | 163 | #define ADC_DUALMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 164 | #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 165 | #define ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 166 | #define ADC_TRIPLEMODE_REGSIMULT_AlterTrig ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_1)) |
phungductung | 0:8ede47d38d10 | 167 | #define ADC_TRIPLEMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 168 | #define ADC_TRIPLEMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1)) |
phungductung | 0:8ede47d38d10 | 169 | #define ADC_TRIPLEMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 170 | #define ADC_TRIPLEMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0)) |
phungductung | 0:8ede47d38d10 | 171 | /** |
phungductung | 0:8ede47d38d10 | 172 | * @} |
phungductung | 0:8ede47d38d10 | 173 | */ |
phungductung | 0:8ede47d38d10 | 174 | |
phungductung | 0:8ede47d38d10 | 175 | /** @defgroup ADCEx_Direct_memory_access_mode_for_multi_mode ADC Direct Memory Access Mode For Multi Mode |
phungductung | 0:8ede47d38d10 | 176 | * @{ |
phungductung | 0:8ede47d38d10 | 177 | */ |
phungductung | 0:8ede47d38d10 | 178 | #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA mode disabled */ |
phungductung | 0:8ede47d38d10 | 179 | #define ADC_DMAACCESSMODE_1 ((uint32_t)ADC_CCR_DMA_0) /*!< DMA mode 1 enabled (2 / 3 half-words one by one - 1 then 2 then 3)*/ |
phungductung | 0:8ede47d38d10 | 180 | #define ADC_DMAACCESSMODE_2 ((uint32_t)ADC_CCR_DMA_1) /*!< DMA mode 2 enabled (2 / 3 half-words by pairs - 2&1 then 1&3 then 3&2)*/ |
phungductung | 0:8ede47d38d10 | 181 | #define ADC_DMAACCESSMODE_3 ((uint32_t)ADC_CCR_DMA) /*!< DMA mode 3 enabled (2 / 3 bytes by pairs - 2&1 then 1&3 then 3&2) */ |
phungductung | 0:8ede47d38d10 | 182 | /** |
phungductung | 0:8ede47d38d10 | 183 | * @} |
phungductung | 0:8ede47d38d10 | 184 | */ |
phungductung | 0:8ede47d38d10 | 185 | |
phungductung | 0:8ede47d38d10 | 186 | /** @defgroup ADCEx_External_trigger_edge_Injected ADC External Trigger Edge Injected |
phungductung | 0:8ede47d38d10 | 187 | * @{ |
phungductung | 0:8ede47d38d10 | 188 | */ |
phungductung | 0:8ede47d38d10 | 189 | #define ADC_EXTERNALTRIGINJECCONVEDGE_NONE ((uint32_t)0x00000000) |
phungductung | 0:8ede47d38d10 | 190 | #define ADC_EXTERNALTRIGINJECCONVEDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0) |
phungductung | 0:8ede47d38d10 | 191 | #define ADC_EXTERNALTRIGINJECCONVEDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1) |
phungductung | 0:8ede47d38d10 | 192 | #define ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN) |
phungductung | 0:8ede47d38d10 | 193 | /** |
phungductung | 0:8ede47d38d10 | 194 | * @} |
phungductung | 0:8ede47d38d10 | 195 | */ |
phungductung | 0:8ede47d38d10 | 196 | |
phungductung | 0:8ede47d38d10 | 197 | /** @defgroup ADCEx_External_trigger_Source_Injected ADC External Trigger Source Injected |
phungductung | 0:8ede47d38d10 | 198 | * @{ |
phungductung | 0:8ede47d38d10 | 199 | */ |
phungductung | 0:8ede47d38d10 | 200 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ((uint32_t)0x00000000) |
phungductung | 0:8ede47d38d10 | 201 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ((uint32_t)ADC_CR2_JEXTSEL_0) |
phungductung | 0:8ede47d38d10 | 202 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ((uint32_t)ADC_CR2_JEXTSEL_1) |
phungductung | 0:8ede47d38d10 | 203 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 204 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ((uint32_t)ADC_CR2_JEXTSEL_2) |
phungductung | 0:8ede47d38d10 | 205 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 206 | |
phungductung | 0:8ede47d38d10 | 207 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 208 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ((uint32_t)ADC_CR2_JEXTSEL_3) |
phungductung | 0:8ede47d38d10 | 209 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 210 | #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1)) |
phungductung | 0:8ede47d38d10 | 211 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 212 | #define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2)) |
phungductung | 0:8ede47d38d10 | 213 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
phungductung | 0:8ede47d38d10 | 214 | #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1)) |
phungductung | 0:8ede47d38d10 | 215 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)ADC_CR2_JEXTSEL + 1) |
phungductung | 0:8ede47d38d10 | 216 | /** |
phungductung | 0:8ede47d38d10 | 217 | * @} |
phungductung | 0:8ede47d38d10 | 218 | */ |
phungductung | 0:8ede47d38d10 | 219 | |
phungductung | 0:8ede47d38d10 | 220 | /** @defgroup ADCEx_injected_channel_selection ADC Injected Channel Selection |
phungductung | 0:8ede47d38d10 | 221 | * @{ |
phungductung | 0:8ede47d38d10 | 222 | */ |
phungductung | 0:8ede47d38d10 | 223 | #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) |
phungductung | 0:8ede47d38d10 | 224 | #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) |
phungductung | 0:8ede47d38d10 | 225 | #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) |
phungductung | 0:8ede47d38d10 | 226 | #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) |
phungductung | 0:8ede47d38d10 | 227 | /** |
phungductung | 0:8ede47d38d10 | 228 | * @} |
phungductung | 0:8ede47d38d10 | 229 | */ |
phungductung | 0:8ede47d38d10 | 230 | |
phungductung | 0:8ede47d38d10 | 231 | /** @defgroup ADCEx_channels ADC Specific Channels |
phungductung | 0:8ede47d38d10 | 232 | * @{ |
phungductung | 0:8ede47d38d10 | 233 | */ |
phungductung | 0:8ede47d38d10 | 234 | #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_18 | 0x10000000) |
phungductung | 0:8ede47d38d10 | 235 | /** |
phungductung | 0:8ede47d38d10 | 236 | * @} |
phungductung | 0:8ede47d38d10 | 237 | */ |
phungductung | 0:8ede47d38d10 | 238 | |
phungductung | 0:8ede47d38d10 | 239 | /** |
phungductung | 0:8ede47d38d10 | 240 | * @} |
phungductung | 0:8ede47d38d10 | 241 | */ |
phungductung | 0:8ede47d38d10 | 242 | |
phungductung | 0:8ede47d38d10 | 243 | /* Exported macro ------------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 244 | /** @defgroup ADC_Exported_Macros ADC Exported Macros |
phungductung | 0:8ede47d38d10 | 245 | * @{ |
phungductung | 0:8ede47d38d10 | 246 | */ |
phungductung | 0:8ede47d38d10 | 247 | /** |
phungductung | 0:8ede47d38d10 | 248 | * @} |
phungductung | 0:8ede47d38d10 | 249 | */ |
phungductung | 0:8ede47d38d10 | 250 | |
phungductung | 0:8ede47d38d10 | 251 | /* Exported functions --------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 252 | /** @addtogroup ADCEx_Exported_Functions |
phungductung | 0:8ede47d38d10 | 253 | * @{ |
phungductung | 0:8ede47d38d10 | 254 | */ |
phungductung | 0:8ede47d38d10 | 255 | |
phungductung | 0:8ede47d38d10 | 256 | /** @addtogroup ADCEx_Exported_Functions_Group1 |
phungductung | 0:8ede47d38d10 | 257 | * @{ |
phungductung | 0:8ede47d38d10 | 258 | */ |
phungductung | 0:8ede47d38d10 | 259 | |
phungductung | 0:8ede47d38d10 | 260 | /* I/O operation functions ******************************************************/ |
phungductung | 0:8ede47d38d10 | 261 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 262 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 263 | HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout); |
phungductung | 0:8ede47d38d10 | 264 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 265 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 266 | uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank); |
phungductung | 0:8ede47d38d10 | 267 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length); |
phungductung | 0:8ede47d38d10 | 268 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 269 | uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 270 | void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc); |
phungductung | 0:8ede47d38d10 | 271 | |
phungductung | 0:8ede47d38d10 | 272 | /* Peripheral Control functions *************************************************/ |
phungductung | 0:8ede47d38d10 | 273 | HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected); |
phungductung | 0:8ede47d38d10 | 274 | HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_MultiModeTypeDef* multimode); |
phungductung | 0:8ede47d38d10 | 275 | |
phungductung | 0:8ede47d38d10 | 276 | /** |
phungductung | 0:8ede47d38d10 | 277 | * @} |
phungductung | 0:8ede47d38d10 | 278 | */ |
phungductung | 0:8ede47d38d10 | 279 | |
phungductung | 0:8ede47d38d10 | 280 | /** |
phungductung | 0:8ede47d38d10 | 281 | * @} |
phungductung | 0:8ede47d38d10 | 282 | */ |
phungductung | 0:8ede47d38d10 | 283 | /* Private types -------------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 284 | /* Private variables ---------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 285 | /* Private constants ---------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 286 | /** @defgroup ADCEx_Private_Constants ADC Private Constants |
phungductung | 0:8ede47d38d10 | 287 | * @{ |
phungductung | 0:8ede47d38d10 | 288 | */ |
phungductung | 0:8ede47d38d10 | 289 | |
phungductung | 0:8ede47d38d10 | 290 | /** |
phungductung | 0:8ede47d38d10 | 291 | * @} |
phungductung | 0:8ede47d38d10 | 292 | */ |
phungductung | 0:8ede47d38d10 | 293 | |
phungductung | 0:8ede47d38d10 | 294 | /* Private macros ------------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 295 | /** @defgroup ADCEx_Private_Macros ADC Private Macros |
phungductung | 0:8ede47d38d10 | 296 | * @{ |
phungductung | 0:8ede47d38d10 | 297 | */ |
phungductung | 0:8ede47d38d10 | 298 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) <= ADC_CHANNEL_18) || \ |
phungductung | 0:8ede47d38d10 | 299 | ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR)) |
phungductung | 0:8ede47d38d10 | 300 | |
phungductung | 0:8ede47d38d10 | 301 | #define IS_ADC_MODE(__MODE__) (((__MODE__) == ADC_MODE_INDEPENDENT) || \ |
phungductung | 0:8ede47d38d10 | 302 | ((__MODE__) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 303 | ((__MODE__) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \ |
phungductung | 0:8ede47d38d10 | 304 | ((__MODE__) == ADC_DUALMODE_INJECSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 305 | ((__MODE__) == ADC_DUALMODE_REGSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 306 | ((__MODE__) == ADC_DUALMODE_INTERL) || \ |
phungductung | 0:8ede47d38d10 | 307 | ((__MODE__) == ADC_DUALMODE_ALTERTRIG) || \ |
phungductung | 0:8ede47d38d10 | 308 | ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 309 | ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_AlterTrig) || \ |
phungductung | 0:8ede47d38d10 | 310 | ((__MODE__) == ADC_TRIPLEMODE_INJECSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 311 | ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT) || \ |
phungductung | 0:8ede47d38d10 | 312 | ((__MODE__) == ADC_TRIPLEMODE_INTERL) || \ |
phungductung | 0:8ede47d38d10 | 313 | ((__MODE__) == ADC_TRIPLEMODE_ALTERTRIG)) |
phungductung | 0:8ede47d38d10 | 314 | #define IS_ADC_DMA_ACCESS_MODE(__MODE__) (((__MODE__) == ADC_DMAACCESSMODE_DISABLED) || \ |
phungductung | 0:8ede47d38d10 | 315 | ((__MODE__) == ADC_DMAACCESSMODE_1) || \ |
phungductung | 0:8ede47d38d10 | 316 | ((__MODE__) == ADC_DMAACCESSMODE_2) || \ |
phungductung | 0:8ede47d38d10 | 317 | ((__MODE__) == ADC_DMAACCESSMODE_3)) |
phungductung | 0:8ede47d38d10 | 318 | #define IS_ADC_EXT_INJEC_TRIG_EDGE(__EDGE__) (((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_NONE) || \ |
phungductung | 0:8ede47d38d10 | 319 | ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISING) || \ |
phungductung | 0:8ede47d38d10 | 320 | ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_FALLING) || \ |
phungductung | 0:8ede47d38d10 | 321 | ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING)) |
phungductung | 0:8ede47d38d10 | 322 | #define IS_ADC_EXT_INJEC_TRIG(__INJTRIG__) (((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 323 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
phungductung | 0:8ede47d38d10 | 324 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 325 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
phungductung | 0:8ede47d38d10 | 326 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
phungductung | 0:8ede47d38d10 | 327 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 328 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \ |
phungductung | 0:8ede47d38d10 | 329 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \ |
phungductung | 0:8ede47d38d10 | 330 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 331 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \ |
phungductung | 0:8ede47d38d10 | 332 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \ |
phungductung | 0:8ede47d38d10 | 333 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 334 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \ |
phungductung | 0:8ede47d38d10 | 335 | ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \ |
phungductung | 0:8ede47d38d10 | 336 | ((__INJTRIG__) == ADC_INJECTED_SOFTWARE_START)) |
phungductung | 0:8ede47d38d10 | 337 | #define IS_ADC_INJECTED_LENGTH(__LENGTH__) (((__LENGTH__) >= ((uint32_t)1)) && ((__LENGTH__) <= ((uint32_t)4))) |
phungductung | 0:8ede47d38d10 | 338 | #define IS_ADC_INJECTED_RANK(__RANK__) (((__RANK__) >= ((uint32_t)1)) && ((__RANK__) <= ((uint32_t)4))) |
phungductung | 0:8ede47d38d10 | 339 | |
phungductung | 0:8ede47d38d10 | 340 | /** |
phungductung | 0:8ede47d38d10 | 341 | * @brief Set the selected injected Channel rank. |
phungductung | 0:8ede47d38d10 | 342 | * @param _CHANNELNB_: Channel number. |
phungductung | 0:8ede47d38d10 | 343 | * @param _RANKNB_: Rank number. |
phungductung | 0:8ede47d38d10 | 344 | * @param _JSQR_JL_: Sequence length. |
phungductung | 0:8ede47d38d10 | 345 | * @retval None |
phungductung | 0:8ede47d38d10 | 346 | */ |
phungductung | 0:8ede47d38d10 | 347 | #define ADC_JSQR(_CHANNELNB_, _RANKNB_,_JSQR_JL_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * (uint8_t)(((_RANKNB_) + 3) - (_JSQR_JL_)))) |
phungductung | 0:8ede47d38d10 | 348 | /** |
phungductung | 0:8ede47d38d10 | 349 | * @} |
phungductung | 0:8ede47d38d10 | 350 | */ |
phungductung | 0:8ede47d38d10 | 351 | |
phungductung | 0:8ede47d38d10 | 352 | /* Private functions ---------------------------------------------------------*/ |
phungductung | 0:8ede47d38d10 | 353 | /** @defgroup ADCEx_Private_Functions ADC Private Functions |
phungductung | 0:8ede47d38d10 | 354 | * @{ |
phungductung | 0:8ede47d38d10 | 355 | */ |
phungductung | 0:8ede47d38d10 | 356 | |
phungductung | 0:8ede47d38d10 | 357 | /** |
phungductung | 0:8ede47d38d10 | 358 | * @} |
phungductung | 0:8ede47d38d10 | 359 | */ |
phungductung | 0:8ede47d38d10 | 360 | |
phungductung | 0:8ede47d38d10 | 361 | /** |
phungductung | 0:8ede47d38d10 | 362 | * @} |
phungductung | 0:8ede47d38d10 | 363 | */ |
phungductung | 0:8ede47d38d10 | 364 | |
phungductung | 0:8ede47d38d10 | 365 | /** |
phungductung | 0:8ede47d38d10 | 366 | * @} |
phungductung | 0:8ede47d38d10 | 367 | */ |
phungductung | 0:8ede47d38d10 | 368 | |
phungductung | 0:8ede47d38d10 | 369 | #ifdef __cplusplus |
phungductung | 0:8ede47d38d10 | 370 | } |
phungductung | 0:8ede47d38d10 | 371 | #endif |
phungductung | 0:8ede47d38d10 | 372 | |
phungductung | 0:8ede47d38d10 | 373 | #endif /*__STM32F7xx_ADC_EX_H */ |
phungductung | 0:8ede47d38d10 | 374 | |
phungductung | 0:8ede47d38d10 | 375 | |
phungductung | 0:8ede47d38d10 | 376 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |