SPKT

Dependents:   WAV

Committer:
phungductung
Date:
Tue Jun 04 21:51:46 2019 +0000
Revision:
0:e87aa4c49e95
libray

Who changed what in which revision?

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