Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Parent:
107:4f6c30876dfa
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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