Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Parent:
115:87f2f5183dfb
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 115:87f2f5183dfb 1 /**
Kojto 115:87f2f5183dfb 2 ******************************************************************************
Kojto 115:87f2f5183dfb 3 * @file stm32f7xx_hal_adc.h
Kojto 115:87f2f5183dfb 4 * @author MCD Application Team
Kojto 116:c0f6e94411f5 5 * @version V1.0.4
Kojto 116:c0f6e94411f5 6 * @date 09-December-2015
Kojto 115:87f2f5183dfb 7 * @brief Header file of ADC HAL module.
Kojto 115:87f2f5183dfb 8 ******************************************************************************
Kojto 115:87f2f5183dfb 9 * @attention
Kojto 115:87f2f5183dfb 10 *
Kojto 115:87f2f5183dfb 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 115:87f2f5183dfb 12 *
Kojto 115:87f2f5183dfb 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 115:87f2f5183dfb 14 * are permitted provided that the following conditions are met:
Kojto 115:87f2f5183dfb 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 115:87f2f5183dfb 16 * this list of conditions and the following disclaimer.
Kojto 115:87f2f5183dfb 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 115:87f2f5183dfb 18 * this list of conditions and the following disclaimer in the documentation
Kojto 115:87f2f5183dfb 19 * and/or other materials provided with the distribution.
Kojto 115:87f2f5183dfb 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 115:87f2f5183dfb 21 * may be used to endorse or promote products derived from this software
Kojto 115:87f2f5183dfb 22 * without specific prior written permission.
Kojto 115:87f2f5183dfb 23 *
Kojto 115:87f2f5183dfb 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 115:87f2f5183dfb 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 115:87f2f5183dfb 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 115:87f2f5183dfb 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 115:87f2f5183dfb 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 115:87f2f5183dfb 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 115:87f2f5183dfb 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 115:87f2f5183dfb 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 115:87f2f5183dfb 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 115:87f2f5183dfb 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 115:87f2f5183dfb 34 *
Kojto 115:87f2f5183dfb 35 ******************************************************************************
Kojto 115:87f2f5183dfb 36 */
Kojto 115:87f2f5183dfb 37
Kojto 115:87f2f5183dfb 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 115:87f2f5183dfb 39 #ifndef __STM32F7xx_ADC_EX_H
Kojto 115:87f2f5183dfb 40 #define __STM32F7xx_ADC_EX_H
Kojto 115:87f2f5183dfb 41
Kojto 115:87f2f5183dfb 42 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 43 extern "C" {
Kojto 115:87f2f5183dfb 44 #endif
Kojto 115:87f2f5183dfb 45
Kojto 115:87f2f5183dfb 46 /* Includes ------------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 47 #include "stm32f7xx_hal_def.h"
Kojto 115:87f2f5183dfb 48
Kojto 115:87f2f5183dfb 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 115:87f2f5183dfb 50 * @{
Kojto 115:87f2f5183dfb 51 */
Kojto 115:87f2f5183dfb 52
Kojto 115:87f2f5183dfb 53 /** @addtogroup ADCEx
Kojto 115:87f2f5183dfb 54 * @{
Kojto 115:87f2f5183dfb 55 */
Kojto 115:87f2f5183dfb 56
Kojto 115:87f2f5183dfb 57 /* Exported types ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 58 /** @defgroup ADCEx_Exported_Types ADC Exported Types
Kojto 115:87f2f5183dfb 59 * @{
Kojto 115:87f2f5183dfb 60 */
Kojto 115:87f2f5183dfb 61
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 74 typedef struct
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 132
Kojto 115:87f2f5183dfb 133 /**
Kojto 116:c0f6e94411f5 134 * @brief ADC Configuration multi-mode structure definition
Kojto 115:87f2f5183dfb 135 */
Kojto 115:87f2f5183dfb 136 typedef struct
Kojto 115:87f2f5183dfb 137 {
Kojto 115:87f2f5183dfb 138 uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode.
Kojto 115:87f2f5183dfb 139 This parameter can be a value of @ref ADCEx_Common_mode */
Kojto 115:87f2f5183dfb 140 uint32_t DMAAccessMode; /*!< Configures the Direct memory access mode for multi ADC mode.
Kojto 115:87f2f5183dfb 141 This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multi_mode */
Kojto 115:87f2f5183dfb 142 uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases.
Kojto 115:87f2f5183dfb 143 This parameter can be a value of @ref ADC_delay_between_2_sampling_phases */
Kojto 115:87f2f5183dfb 144 }ADC_MultiModeTypeDef;
Kojto 115:87f2f5183dfb 145
Kojto 115:87f2f5183dfb 146 /**
Kojto 115:87f2f5183dfb 147 * @}
Kojto 115:87f2f5183dfb 148 */
Kojto 115:87f2f5183dfb 149
Kojto 115:87f2f5183dfb 150 /* Exported constants --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 151 /** @defgroup ADCEx_Exported_Constants ADC Exported Constants
Kojto 115:87f2f5183dfb 152 * @{
Kojto 115:87f2f5183dfb 153 */
Kojto 115:87f2f5183dfb 154
Kojto 115:87f2f5183dfb 155 /** @defgroup ADCEx_Common_mode ADC Common Mode
Kojto 115:87f2f5183dfb 156 * @{
Kojto 115:87f2f5183dfb 157 */
Kojto 115:87f2f5183dfb 158 #define ADC_MODE_INDEPENDENT ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 159 #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)ADC_CCR_MULTI_0)
Kojto 115:87f2f5183dfb 160 #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)ADC_CCR_MULTI_1)
Kojto 115:87f2f5183dfb 161 #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 162 #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1))
Kojto 115:87f2f5183dfb 163 #define ADC_DUALMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 164 #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 165 #define ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 166 #define ADC_TRIPLEMODE_REGSIMULT_AlterTrig ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_1))
Kojto 115:87f2f5183dfb 167 #define ADC_TRIPLEMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 168 #define ADC_TRIPLEMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1))
Kojto 115:87f2f5183dfb 169 #define ADC_TRIPLEMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 170 #define ADC_TRIPLEMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0))
Kojto 115:87f2f5183dfb 171 /**
Kojto 115:87f2f5183dfb 172 * @}
Kojto 115:87f2f5183dfb 173 */
Kojto 115:87f2f5183dfb 174
Kojto 115:87f2f5183dfb 175 /** @defgroup ADCEx_Direct_memory_access_mode_for_multi_mode ADC Direct Memory Access Mode For Multi Mode
Kojto 115:87f2f5183dfb 176 * @{
Kojto 115:87f2f5183dfb 177 */
Kojto 115:87f2f5183dfb 178 #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA mode disabled */
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 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 115:87f2f5183dfb 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 115:87f2f5183dfb 182 /**
Kojto 115:87f2f5183dfb 183 * @}
Kojto 115:87f2f5183dfb 184 */
Kojto 115:87f2f5183dfb 185
Kojto 115:87f2f5183dfb 186 /** @defgroup ADCEx_External_trigger_edge_Injected ADC External Trigger Edge Injected
Kojto 115:87f2f5183dfb 187 * @{
Kojto 115:87f2f5183dfb 188 */
Kojto 115:87f2f5183dfb 189 #define ADC_EXTERNALTRIGINJECCONVEDGE_NONE ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 190 #define ADC_EXTERNALTRIGINJECCONVEDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0)
Kojto 115:87f2f5183dfb 191 #define ADC_EXTERNALTRIGINJECCONVEDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1)
Kojto 115:87f2f5183dfb 192 #define ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN)
Kojto 115:87f2f5183dfb 193 /**
Kojto 115:87f2f5183dfb 194 * @}
Kojto 115:87f2f5183dfb 195 */
Kojto 115:87f2f5183dfb 196
Kojto 115:87f2f5183dfb 197 /** @defgroup ADCEx_External_trigger_Source_Injected ADC External Trigger Source Injected
Kojto 115:87f2f5183dfb 198 * @{
Kojto 115:87f2f5183dfb 199 */
Kojto 115:87f2f5183dfb 200 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 201 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ((uint32_t)ADC_CR2_JEXTSEL_0)
Kojto 115:87f2f5183dfb 202 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ((uint32_t)ADC_CR2_JEXTSEL_1)
Kojto 115:87f2f5183dfb 203 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 204 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ((uint32_t)ADC_CR2_JEXTSEL_2)
Kojto 115:87f2f5183dfb 205 #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 206
Kojto 115:87f2f5183dfb 207 #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 208 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ((uint32_t)ADC_CR2_JEXTSEL_3)
Kojto 115:87f2f5183dfb 209 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 210 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1))
Kojto 115:87f2f5183dfb 211 #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 212 #define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2))
Kojto 115:87f2f5183dfb 213 #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 216 /**
Kojto 115:87f2f5183dfb 217 * @}
Kojto 115:87f2f5183dfb 218 */
Kojto 115:87f2f5183dfb 219
Kojto 115:87f2f5183dfb 220 /** @defgroup ADCEx_injected_channel_selection ADC Injected Channel Selection
Kojto 115:87f2f5183dfb 221 * @{
Kojto 115:87f2f5183dfb 222 */
Kojto 115:87f2f5183dfb 223 #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001)
Kojto 115:87f2f5183dfb 224 #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002)
Kojto 115:87f2f5183dfb 225 #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003)
Kojto 115:87f2f5183dfb 226 #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004)
Kojto 115:87f2f5183dfb 227 /**
Kojto 115:87f2f5183dfb 228 * @}
Kojto 115:87f2f5183dfb 229 */
Kojto 115:87f2f5183dfb 230
Kojto 115:87f2f5183dfb 231 /** @defgroup ADCEx_channels ADC Specific Channels
Kojto 115:87f2f5183dfb 232 * @{
Kojto 115:87f2f5183dfb 233 */
Kojto 116:c0f6e94411f5 234 #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_18 | 0x10000000)
Kojto 115:87f2f5183dfb 235 /**
Kojto 115:87f2f5183dfb 236 * @}
Kojto 115:87f2f5183dfb 237 */
Kojto 115:87f2f5183dfb 238
Kojto 115:87f2f5183dfb 239 /**
Kojto 115:87f2f5183dfb 240 * @}
Kojto 115:87f2f5183dfb 241 */
Kojto 115:87f2f5183dfb 242
Kojto 115:87f2f5183dfb 243 /* Exported macro ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 244 /** @defgroup ADC_Exported_Macros ADC Exported Macros
Kojto 115:87f2f5183dfb 245 * @{
Kojto 115:87f2f5183dfb 246 */
Kojto 115:87f2f5183dfb 247 /**
Kojto 115:87f2f5183dfb 248 * @}
Kojto 115:87f2f5183dfb 249 */
Kojto 115:87f2f5183dfb 250
Kojto 115:87f2f5183dfb 251 /* Exported functions --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 252 /** @addtogroup ADCEx_Exported_Functions
Kojto 115:87f2f5183dfb 253 * @{
Kojto 115:87f2f5183dfb 254 */
Kojto 115:87f2f5183dfb 255
Kojto 115:87f2f5183dfb 256 /** @addtogroup ADCEx_Exported_Functions_Group1
Kojto 115:87f2f5183dfb 257 * @{
Kojto 115:87f2f5183dfb 258 */
Kojto 115:87f2f5183dfb 259
Kojto 115:87f2f5183dfb 260 /* I/O operation functions ******************************************************/
Kojto 115:87f2f5183dfb 261 HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc);
Kojto 115:87f2f5183dfb 262 HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);
Kojto 115:87f2f5183dfb 263 HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
Kojto 115:87f2f5183dfb 264 HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc);
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 267 HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 271
Kojto 115:87f2f5183dfb 272 /* Peripheral Control functions *************************************************/
Kojto 115:87f2f5183dfb 273 HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
Kojto 115:87f2f5183dfb 274 HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_MultiModeTypeDef* multimode);
Kojto 115:87f2f5183dfb 275
Kojto 115:87f2f5183dfb 276 /**
Kojto 115:87f2f5183dfb 277 * @}
Kojto 115:87f2f5183dfb 278 */
Kojto 115:87f2f5183dfb 279
Kojto 115:87f2f5183dfb 280 /**
Kojto 115:87f2f5183dfb 281 * @}
Kojto 115:87f2f5183dfb 282 */
Kojto 115:87f2f5183dfb 283 /* Private types -------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 284 /* Private variables ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 285 /* Private constants ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 286 /** @defgroup ADCEx_Private_Constants ADC Private Constants
Kojto 115:87f2f5183dfb 287 * @{
Kojto 115:87f2f5183dfb 288 */
Kojto 115:87f2f5183dfb 289
Kojto 115:87f2f5183dfb 290 /**
Kojto 115:87f2f5183dfb 291 * @}
Kojto 115:87f2f5183dfb 292 */
Kojto 115:87f2f5183dfb 293
Kojto 115:87f2f5183dfb 294 /* Private macros ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 295 /** @defgroup ADCEx_Private_Macros ADC Private Macros
Kojto 115:87f2f5183dfb 296 * @{
Kojto 115:87f2f5183dfb 297 */
Kojto 115:87f2f5183dfb 298 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) <= ADC_CHANNEL_18) || \
Kojto 115:87f2f5183dfb 299 ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR))
Kojto 115:87f2f5183dfb 300
Kojto 115:87f2f5183dfb 301 #define IS_ADC_MODE(__MODE__) (((__MODE__) == ADC_MODE_INDEPENDENT) || \
Kojto 115:87f2f5183dfb 302 ((__MODE__) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
Kojto 115:87f2f5183dfb 303 ((__MODE__) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
Kojto 115:87f2f5183dfb 304 ((__MODE__) == ADC_DUALMODE_INJECSIMULT) || \
Kojto 115:87f2f5183dfb 305 ((__MODE__) == ADC_DUALMODE_REGSIMULT) || \
Kojto 115:87f2f5183dfb 306 ((__MODE__) == ADC_DUALMODE_INTERL) || \
Kojto 115:87f2f5183dfb 307 ((__MODE__) == ADC_DUALMODE_ALTERTRIG) || \
Kojto 115:87f2f5183dfb 308 ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT) || \
Kojto 115:87f2f5183dfb 309 ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_AlterTrig) || \
Kojto 115:87f2f5183dfb 310 ((__MODE__) == ADC_TRIPLEMODE_INJECSIMULT) || \
Kojto 115:87f2f5183dfb 311 ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT) || \
Kojto 115:87f2f5183dfb 312 ((__MODE__) == ADC_TRIPLEMODE_INTERL) || \
Kojto 115:87f2f5183dfb 313 ((__MODE__) == ADC_TRIPLEMODE_ALTERTRIG))
Kojto 115:87f2f5183dfb 314 #define IS_ADC_DMA_ACCESS_MODE(__MODE__) (((__MODE__) == ADC_DMAACCESSMODE_DISABLED) || \
Kojto 115:87f2f5183dfb 315 ((__MODE__) == ADC_DMAACCESSMODE_1) || \
Kojto 115:87f2f5183dfb 316 ((__MODE__) == ADC_DMAACCESSMODE_2) || \
Kojto 115:87f2f5183dfb 317 ((__MODE__) == ADC_DMAACCESSMODE_3))
Kojto 115:87f2f5183dfb 318 #define IS_ADC_EXT_INJEC_TRIG_EDGE(__EDGE__) (((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_NONE) || \
Kojto 115:87f2f5183dfb 319 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISING) || \
Kojto 115:87f2f5183dfb 320 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_FALLING) || \
Kojto 115:87f2f5183dfb 321 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING))
Kojto 115:87f2f5183dfb 322 #define IS_ADC_EXT_INJEC_TRIG(__INJTRIG__) (((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 115:87f2f5183dfb 323 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 115:87f2f5183dfb 324 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 115:87f2f5183dfb 325 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 115:87f2f5183dfb 326 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 115:87f2f5183dfb 327 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 115:87f2f5183dfb 328 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
Kojto 115:87f2f5183dfb 329 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 115:87f2f5183dfb 330 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \
Kojto 115:87f2f5183dfb 331 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \
Kojto 115:87f2f5183dfb 332 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 115:87f2f5183dfb 333 ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \
Kojto 115:87f2f5183dfb 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 115:87f2f5183dfb 337 #define IS_ADC_INJECTED_LENGTH(__LENGTH__) (((__LENGTH__) >= ((uint32_t)1)) && ((__LENGTH__) <= ((uint32_t)4)))
Kojto 115:87f2f5183dfb 338 #define IS_ADC_INJECTED_RANK(__RANK__) (((__RANK__) >= ((uint32_t)1)) && ((__RANK__) <= ((uint32_t)4)))
Kojto 115:87f2f5183dfb 339
Kojto 115:87f2f5183dfb 340 /**
Kojto 115:87f2f5183dfb 341 * @brief Set the selected injected Channel rank.
Kojto 115:87f2f5183dfb 342 * @param _CHANNELNB_: Channel number.
Kojto 115:87f2f5183dfb 343 * @param _RANKNB_: Rank number.
Kojto 115:87f2f5183dfb 344 * @param _JSQR_JL_: Sequence length.
Kojto 115:87f2f5183dfb 345 * @retval None
Kojto 115:87f2f5183dfb 346 */
Kojto 115:87f2f5183dfb 347 #define ADC_JSQR(_CHANNELNB_, _RANKNB_,_JSQR_JL_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * (uint8_t)(((_RANKNB_) + 3) - (_JSQR_JL_))))
Kojto 115:87f2f5183dfb 348 /**
Kojto 115:87f2f5183dfb 349 * @}
Kojto 115:87f2f5183dfb 350 */
Kojto 115:87f2f5183dfb 351
Kojto 115:87f2f5183dfb 352 /* Private functions ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 353 /** @defgroup ADCEx_Private_Functions ADC Private Functions
Kojto 115:87f2f5183dfb 354 * @{
Kojto 115:87f2f5183dfb 355 */
Kojto 115:87f2f5183dfb 356
Kojto 115:87f2f5183dfb 357 /**
Kojto 115:87f2f5183dfb 358 * @}
Kojto 115:87f2f5183dfb 359 */
Kojto 115:87f2f5183dfb 360
Kojto 115:87f2f5183dfb 361 /**
Kojto 115:87f2f5183dfb 362 * @}
Kojto 115:87f2f5183dfb 363 */
Kojto 115:87f2f5183dfb 364
Kojto 115:87f2f5183dfb 365 /**
Kojto 115:87f2f5183dfb 366 * @}
Kojto 115:87f2f5183dfb 367 */
Kojto 115:87f2f5183dfb 368
Kojto 115:87f2f5183dfb 369 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 370 }
Kojto 115:87f2f5183dfb 371 #endif
Kojto 115:87f2f5183dfb 372
Kojto 115:87f2f5183dfb 373 #endif /*__STM32F7xx_ADC_EX_H */
Kojto 115:87f2f5183dfb 374
Kojto 115:87f2f5183dfb 375
Kojto 115:87f2f5183dfb 376 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/