The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

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