meh
Fork of mbed by
TARGET_NUCLEO_F401RE/stm32f4xx_hal_adc_ex.h@106:ba1f97679dad, 2015-09-02 (annotated)
- Committer:
- Kojto
- Date:
- Wed Sep 02 14:17:43 2015 +0100
- Revision:
- 106:ba1f97679dad
- Parent:
- 99:dbbf35b96557
- Child:
- 110:165afa46840b
Release 106 of the mbed library
Changes:
- new platform - Nucleo F446RE
- STM32F4 Cube driver update v2.3.2
- ST cmsis driver v2.3.2
- nordic bugfix gcc linker start address
- lpc11u68 - bugfix for serial ports
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
Kojto | 99:dbbf35b96557 | 3 | * @file stm32f4xx_hal_adc_ex.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
Kojto | 106:ba1f97679dad | 5 | * @version V1.3.2 |
Kojto | 106:ba1f97679dad | 6 | * @date 26-June-2015 |
emilmont | 77:869cf507173a | 7 | * @brief Header file of ADC HAL module. |
emilmont | 77:869cf507173a | 8 | ****************************************************************************** |
emilmont | 77:869cf507173a | 9 | * @attention |
emilmont | 77:869cf507173a | 10 | * |
Kojto | 99:dbbf35b96557 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 12 | * |
emilmont | 77:869cf507173a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
emilmont | 77:869cf507173a | 14 | * are permitted provided that the following conditions are met: |
emilmont | 77:869cf507173a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
emilmont | 77:869cf507173a | 16 | * this list of conditions and the following disclaimer. |
emilmont | 77:869cf507173a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
emilmont | 77:869cf507173a | 18 | * this list of conditions and the following disclaimer in the documentation |
emilmont | 77:869cf507173a | 19 | * and/or other materials provided with the distribution. |
emilmont | 77:869cf507173a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
emilmont | 77:869cf507173a | 21 | * may be used to endorse or promote products derived from this software |
emilmont | 77:869cf507173a | 22 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 23 | * |
emilmont | 77:869cf507173a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 77:869cf507173a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 77:869cf507173a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
emilmont | 77:869cf507173a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
emilmont | 77:869cf507173a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
emilmont | 77:869cf507173a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
emilmont | 77:869cf507173a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emilmont | 77:869cf507173a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
emilmont | 77:869cf507173a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
emilmont | 77:869cf507173a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 34 | * |
emilmont | 77:869cf507173a | 35 | ****************************************************************************** |
emilmont | 77:869cf507173a | 36 | */ |
emilmont | 77:869cf507173a | 37 | |
emilmont | 77:869cf507173a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 39 | #ifndef __STM32F4xx_ADC_EX_H |
emilmont | 77:869cf507173a | 40 | #define __STM32F4xx_ADC_EX_H |
emilmont | 77:869cf507173a | 41 | |
emilmont | 77:869cf507173a | 42 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 43 | extern "C" { |
emilmont | 77:869cf507173a | 44 | #endif |
emilmont | 77:869cf507173a | 45 | |
emilmont | 77:869cf507173a | 46 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 47 | #include "stm32f4xx_hal_def.h" |
emilmont | 77:869cf507173a | 48 | |
emilmont | 77:869cf507173a | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
emilmont | 77:869cf507173a | 50 | * @{ |
emilmont | 77:869cf507173a | 51 | */ |
emilmont | 77:869cf507173a | 52 | |
emilmont | 77:869cf507173a | 53 | /** @addtogroup ADCEx |
emilmont | 77:869cf507173a | 54 | * @{ |
emilmont | 77:869cf507173a | 55 | */ |
emilmont | 77:869cf507173a | 56 | |
emilmont | 77:869cf507173a | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 58 | /** @defgroup ADCEx_Exported_Types ADC Exported Types |
Kojto | 99:dbbf35b96557 | 59 | * @{ |
Kojto | 99:dbbf35b96557 | 60 | */ |
emilmont | 77:869cf507173a | 61 | |
emilmont | 77:869cf507173a | 62 | /** |
Kojto | 99:dbbf35b96557 | 63 | * @brief ADC Configuration injected Channel structure definition |
emilmont | 77:869cf507173a | 64 | */ |
emilmont | 77:869cf507173a | 65 | typedef struct |
emilmont | 77:869cf507173a | 66 | { |
bogdanm | 85:024bf7f99721 | 67 | uint32_t InjectedChannel; /*!< Configure the ADC injected channel. |
bogdanm | 85:024bf7f99721 | 68 | This parameter can be a value of @ref ADC_channels */ |
emilmont | 77:869cf507173a | 69 | uint32_t InjectedRank; /*!< The rank in the injected group sequencer |
emilmont | 77:869cf507173a | 70 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. */ |
emilmont | 77:869cf507173a | 71 | uint32_t InjectedSamplingTime; /*!< The sample time value to be set for the selected channel. |
emilmont | 77:869cf507173a | 72 | This parameter can be a value of @ref ADC_sampling_times */ |
emilmont | 77:869cf507173a | 73 | uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data when convert injected channels. |
emilmont | 77:869cf507173a | 74 | This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ |
emilmont | 77:869cf507173a | 75 | uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ADC conversions that will be done using the sequencer for |
emilmont | 77:869cf507173a | 76 | injected channel group. |
emilmont | 77:869cf507173a | 77 | This parameter must be a number between Min_Data = 1 and Max_Data = 4. */ |
emilmont | 77:869cf507173a | 78 | uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group |
emilmont | 77:869cf507173a | 79 | conversion after regular one */ |
emilmont | 77:869cf507173a | 80 | uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversion is performed in Discontinuous mode or not for injected channels. |
emilmont | 77:869cf507173a | 81 | This parameter can be set to ENABLE or DISABLE. */ |
emilmont | 77:869cf507173a | 82 | uint32_t ExternalTrigInjecConvEdge; /*!< Select the external trigger edge and enable the trigger of an injected channels. |
bogdanm | 85:024bf7f99721 | 83 | This parameter can be a value of @ref ADCEx_External_trigger_edge_Injected */ |
emilmont | 77:869cf507173a | 84 | uint32_t ExternalTrigInjecConv; /*!< Select the external event used to trigger the start of conversion of a injected channels. |
bogdanm | 85:024bf7f99721 | 85 | This parameter can be a value of @ref ADCEx_External_trigger_Source_Injected */ |
emilmont | 77:869cf507173a | 86 | }ADC_InjectionConfTypeDef; |
emilmont | 77:869cf507173a | 87 | |
emilmont | 77:869cf507173a | 88 | /** |
Kojto | 99:dbbf35b96557 | 89 | * @brief ADC Configuration multi-mode structure definition |
emilmont | 77:869cf507173a | 90 | */ |
emilmont | 77:869cf507173a | 91 | typedef struct |
emilmont | 77:869cf507173a | 92 | { |
emilmont | 77:869cf507173a | 93 | uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode. |
bogdanm | 85:024bf7f99721 | 94 | This parameter can be a value of @ref ADCEx_Common_mode */ |
emilmont | 77:869cf507173a | 95 | uint32_t DMAAccessMode; /*!< Configures the Direct memory access mode for multi ADC mode. |
bogdanm | 85:024bf7f99721 | 96 | This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multi_mode */ |
emilmont | 77:869cf507173a | 97 | uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases. |
Kojto | 90:cb3d968589d8 | 98 | This parameter can be a value of @ref ADC_delay_between_2_sampling_phases */ |
emilmont | 77:869cf507173a | 99 | }ADC_MultiModeTypeDef; |
emilmont | 77:869cf507173a | 100 | |
Kojto | 99:dbbf35b96557 | 101 | /** |
Kojto | 99:dbbf35b96557 | 102 | * @} |
Kojto | 99:dbbf35b96557 | 103 | */ |
emilmont | 77:869cf507173a | 104 | |
Kojto | 99:dbbf35b96557 | 105 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 106 | /** @defgroup ADCEx_Exported_Constants ADC Exported Constants |
emilmont | 77:869cf507173a | 107 | * @{ |
emilmont | 77:869cf507173a | 108 | */ |
emilmont | 77:869cf507173a | 109 | |
Kojto | 99:dbbf35b96557 | 110 | /** @defgroup ADCEx_Common_mode ADC Common Mode |
emilmont | 77:869cf507173a | 111 | * @{ |
emilmont | 77:869cf507173a | 112 | */ |
emilmont | 77:869cf507173a | 113 | #define ADC_MODE_INDEPENDENT ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 114 | #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)ADC_CCR_MULTI_0) |
emilmont | 77:869cf507173a | 115 | #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)ADC_CCR_MULTI_1) |
emilmont | 77:869cf507173a | 116 | #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 117 | #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1)) |
emilmont | 77:869cf507173a | 118 | #define ADC_DUALMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 119 | #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 120 | #define ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 121 | #define ADC_TRIPLEMODE_REGSIMULT_AlterTrig ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_1)) |
emilmont | 77:869cf507173a | 122 | #define ADC_TRIPLEMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 123 | #define ADC_TRIPLEMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1)) |
emilmont | 77:869cf507173a | 124 | #define ADC_TRIPLEMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 125 | #define ADC_TRIPLEMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0)) |
emilmont | 77:869cf507173a | 126 | /** |
emilmont | 77:869cf507173a | 127 | * @} |
emilmont | 77:869cf507173a | 128 | */ |
emilmont | 77:869cf507173a | 129 | |
Kojto | 99:dbbf35b96557 | 130 | /** @defgroup ADCEx_Direct_memory_access_mode_for_multi_mode ADC Direct Memory Access Mode For Multi Mode |
emilmont | 77:869cf507173a | 131 | * @{ |
emilmont | 77:869cf507173a | 132 | */ |
emilmont | 77:869cf507173a | 133 | #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA mode disabled */ |
emilmont | 77:869cf507173a | 134 | #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)*/ |
emilmont | 77:869cf507173a | 135 | #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)*/ |
emilmont | 77:869cf507173a | 136 | #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) */ |
emilmont | 77:869cf507173a | 137 | /** |
emilmont | 77:869cf507173a | 138 | * @} |
emilmont | 77:869cf507173a | 139 | */ |
emilmont | 77:869cf507173a | 140 | |
Kojto | 99:dbbf35b96557 | 141 | /** @defgroup ADCEx_External_trigger_edge_Injected ADC External Trigger Edge Injected |
emilmont | 77:869cf507173a | 142 | * @{ |
emilmont | 77:869cf507173a | 143 | */ |
emilmont | 77:869cf507173a | 144 | #define ADC_EXTERNALTRIGINJECCONVEDGE_NONE ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 145 | #define ADC_EXTERNALTRIGINJECCONVEDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0) |
emilmont | 77:869cf507173a | 146 | #define ADC_EXTERNALTRIGINJECCONVEDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1) |
emilmont | 77:869cf507173a | 147 | #define ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN) |
emilmont | 77:869cf507173a | 148 | /** |
emilmont | 77:869cf507173a | 149 | * @} |
emilmont | 77:869cf507173a | 150 | */ |
emilmont | 77:869cf507173a | 151 | |
Kojto | 99:dbbf35b96557 | 152 | /** @defgroup ADCEx_External_trigger_Source_Injected ADC External Trigger Source Injected |
emilmont | 77:869cf507173a | 153 | * @{ |
emilmont | 77:869cf507173a | 154 | */ |
emilmont | 77:869cf507173a | 155 | #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 156 | #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ((uint32_t)ADC_CR2_JEXTSEL_0) |
emilmont | 77:869cf507173a | 157 | #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ((uint32_t)ADC_CR2_JEXTSEL_1) |
emilmont | 77:869cf507173a | 158 | #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 159 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC2 ((uint32_t)ADC_CR2_JEXTSEL_2) |
emilmont | 77:869cf507173a | 160 | #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 161 | #define ADC_EXTERNALTRIGINJECCONV_T4_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1)) |
emilmont | 77:869cf507173a | 162 | #define ADC_EXTERNALTRIGINJECCONV_T4_CC2 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 163 | #define ADC_EXTERNALTRIGINJECCONV_T4_CC3 ((uint32_t)ADC_CR2_JEXTSEL_3) |
emilmont | 77:869cf507173a | 164 | #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 165 | #define ADC_EXTERNALTRIGINJECCONV_T5_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1)) |
emilmont | 77:869cf507173a | 166 | #define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 167 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC2 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2)) |
emilmont | 77:869cf507173a | 168 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC3 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0)) |
emilmont | 77:869cf507173a | 169 | #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1)) |
emilmont | 77:869cf507173a | 170 | #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ((uint32_t)ADC_CR2_JEXTSEL) |
Kojto | 106:ba1f97679dad | 171 | #define ADC_INJECTED_SOFTWARE_START ((uint32_t)ADC_CR2_JEXTSEL + 1) |
Kojto | 99:dbbf35b96557 | 172 | /** |
Kojto | 99:dbbf35b96557 | 173 | * @} |
Kojto | 99:dbbf35b96557 | 174 | */ |
emilmont | 77:869cf507173a | 175 | |
Kojto | 99:dbbf35b96557 | 176 | /** @defgroup ADCEx_injected_channel_selection ADC Injected Channel Selection |
Kojto | 99:dbbf35b96557 | 177 | * @{ |
Kojto | 99:dbbf35b96557 | 178 | */ |
Kojto | 99:dbbf35b96557 | 179 | #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) |
Kojto | 99:dbbf35b96557 | 180 | #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) |
Kojto | 99:dbbf35b96557 | 181 | #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) |
Kojto | 99:dbbf35b96557 | 182 | #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) |
Kojto | 99:dbbf35b96557 | 183 | /** |
Kojto | 99:dbbf35b96557 | 184 | * @} |
Kojto | 99:dbbf35b96557 | 185 | */ |
Kojto | 99:dbbf35b96557 | 186 | |
Kojto | 99:dbbf35b96557 | 187 | /** @defgroup ADCEx_channels ADC Specific Channels |
Kojto | 99:dbbf35b96557 | 188 | * @{ |
Kojto | 99:dbbf35b96557 | 189 | */ |
Kojto | 99:dbbf35b96557 | 190 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
Kojto | 99:dbbf35b96557 | 191 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) |
Kojto | 99:dbbf35b96557 | 192 | #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_16) |
Kojto | 99:dbbf35b96557 | 193 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */ |
Kojto | 99:dbbf35b96557 | 194 | |
Kojto | 99:dbbf35b96557 | 195 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) |
Kojto | 99:dbbf35b96557 | 196 | #define ADC_CHANNEL_DIFFERENCIATION_TEMPSENSOR_VBAT ((uint32_t)0x10000000) /* Dummy bit for driver internal usage, not used in ADC channel setting registers CR1 or SQRx */ |
Kojto | 99:dbbf35b96557 | 197 | #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_18 | ADC_CHANNEL_DIFFERENCIATION_TEMPSENSOR_VBAT) |
Kojto | 99:dbbf35b96557 | 198 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */ |
Kojto | 99:dbbf35b96557 | 199 | /** |
Kojto | 99:dbbf35b96557 | 200 | * @} |
Kojto | 99:dbbf35b96557 | 201 | */ |
Kojto | 99:dbbf35b96557 | 202 | |
Kojto | 99:dbbf35b96557 | 203 | |
Kojto | 99:dbbf35b96557 | 204 | /** |
Kojto | 99:dbbf35b96557 | 205 | * @} |
Kojto | 99:dbbf35b96557 | 206 | */ |
Kojto | 99:dbbf35b96557 | 207 | |
Kojto | 99:dbbf35b96557 | 208 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 209 | /** @defgroup ADC_Exported_Macros ADC Exported Macros |
Kojto | 99:dbbf35b96557 | 210 | * @{ |
Kojto | 99:dbbf35b96557 | 211 | */ |
Kojto | 99:dbbf35b96557 | 212 | |
Kojto | 99:dbbf35b96557 | 213 | /** |
Kojto | 99:dbbf35b96557 | 214 | * @} |
Kojto | 99:dbbf35b96557 | 215 | */ |
Kojto | 99:dbbf35b96557 | 216 | |
Kojto | 99:dbbf35b96557 | 217 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 218 | /** @addtogroup ADCEx_Exported_Functions |
Kojto | 99:dbbf35b96557 | 219 | * @{ |
Kojto | 99:dbbf35b96557 | 220 | */ |
Kojto | 99:dbbf35b96557 | 221 | |
Kojto | 99:dbbf35b96557 | 222 | /** @addtogroup ADCEx_Exported_Functions_Group1 |
Kojto | 99:dbbf35b96557 | 223 | * @{ |
Kojto | 99:dbbf35b96557 | 224 | */ |
Kojto | 99:dbbf35b96557 | 225 | |
Kojto | 99:dbbf35b96557 | 226 | /* I/O operation functions ******************************************************/ |
Kojto | 99:dbbf35b96557 | 227 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 228 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 229 | HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout); |
Kojto | 99:dbbf35b96557 | 230 | HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 231 | HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 232 | uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank); |
Kojto | 99:dbbf35b96557 | 233 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length); |
Kojto | 99:dbbf35b96557 | 234 | HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 235 | uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 236 | void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc); |
Kojto | 99:dbbf35b96557 | 237 | |
Kojto | 99:dbbf35b96557 | 238 | /* Peripheral Control functions *************************************************/ |
Kojto | 99:dbbf35b96557 | 239 | HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected); |
Kojto | 99:dbbf35b96557 | 240 | HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_MultiModeTypeDef* multimode); |
Kojto | 99:dbbf35b96557 | 241 | |
Kojto | 99:dbbf35b96557 | 242 | /** |
Kojto | 99:dbbf35b96557 | 243 | * @} |
Kojto | 99:dbbf35b96557 | 244 | */ |
Kojto | 99:dbbf35b96557 | 245 | |
Kojto | 99:dbbf35b96557 | 246 | /** |
Kojto | 99:dbbf35b96557 | 247 | * @} |
Kojto | 99:dbbf35b96557 | 248 | */ |
Kojto | 99:dbbf35b96557 | 249 | /* Private types -------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 250 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 251 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 252 | /** @defgroup ADCEx_Private_Constants ADC Private Constants |
Kojto | 99:dbbf35b96557 | 253 | * @{ |
Kojto | 99:dbbf35b96557 | 254 | */ |
Kojto | 99:dbbf35b96557 | 255 | |
Kojto | 99:dbbf35b96557 | 256 | /** |
Kojto | 99:dbbf35b96557 | 257 | * @} |
Kojto | 99:dbbf35b96557 | 258 | */ |
Kojto | 99:dbbf35b96557 | 259 | |
Kojto | 99:dbbf35b96557 | 260 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 261 | /** @defgroup ADCEx_Private_Macros ADC Private Macros |
Kojto | 99:dbbf35b96557 | 262 | * @{ |
Kojto | 99:dbbf35b96557 | 263 | */ |
Kojto | 99:dbbf35b96557 | 264 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
Kojto | 99:dbbf35b96557 | 265 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) |
Kojto | 99:dbbf35b96557 | 266 | #define IS_ADC_CHANNEL(CHANNEL) ((CHANNEL) <= ADC_CHANNEL_18) |
Kojto | 99:dbbf35b96557 | 267 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */ |
Kojto | 99:dbbf35b96557 | 268 | |
Kojto | 99:dbbf35b96557 | 269 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) |
Kojto | 99:dbbf35b96557 | 270 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) <= ADC_CHANNEL_18) || \ |
Kojto | 99:dbbf35b96557 | 271 | ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR)) |
Kojto | 99:dbbf35b96557 | 272 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */ |
Kojto | 99:dbbf35b96557 | 273 | |
Kojto | 99:dbbf35b96557 | 274 | #define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \ |
Kojto | 99:dbbf35b96557 | 275 | ((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 276 | ((MODE) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \ |
Kojto | 99:dbbf35b96557 | 277 | ((MODE) == ADC_DUALMODE_INJECSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 278 | ((MODE) == ADC_DUALMODE_REGSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 279 | ((MODE) == ADC_DUALMODE_INTERL) || \ |
Kojto | 99:dbbf35b96557 | 280 | ((MODE) == ADC_DUALMODE_ALTERTRIG) || \ |
Kojto | 99:dbbf35b96557 | 281 | ((MODE) == ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 282 | ((MODE) == ADC_TRIPLEMODE_REGSIMULT_AlterTrig) || \ |
Kojto | 99:dbbf35b96557 | 283 | ((MODE) == ADC_TRIPLEMODE_INJECSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 284 | ((MODE) == ADC_TRIPLEMODE_REGSIMULT) || \ |
Kojto | 99:dbbf35b96557 | 285 | ((MODE) == ADC_TRIPLEMODE_INTERL) || \ |
Kojto | 99:dbbf35b96557 | 286 | ((MODE) == ADC_TRIPLEMODE_ALTERTRIG)) |
Kojto | 99:dbbf35b96557 | 287 | #define IS_ADC_DMA_ACCESS_MODE(MODE) (((MODE) == ADC_DMAACCESSMODE_DISABLED) || \ |
Kojto | 99:dbbf35b96557 | 288 | ((MODE) == ADC_DMAACCESSMODE_1) || \ |
Kojto | 99:dbbf35b96557 | 289 | ((MODE) == ADC_DMAACCESSMODE_2) || \ |
Kojto | 99:dbbf35b96557 | 290 | ((MODE) == ADC_DMAACCESSMODE_3)) |
Kojto | 99:dbbf35b96557 | 291 | #define IS_ADC_EXT_INJEC_TRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONVEDGE_NONE) || \ |
Kojto | 99:dbbf35b96557 | 292 | ((EDGE) == ADC_EXTERNALTRIGINJECCONVEDGE_RISING) || \ |
Kojto | 99:dbbf35b96557 | 293 | ((EDGE) == ADC_EXTERNALTRIGINJECCONVEDGE_FALLING) || \ |
Kojto | 99:dbbf35b96557 | 294 | ((EDGE) == ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING)) |
emilmont | 77:869cf507173a | 295 | #define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \ |
emilmont | 77:869cf507173a | 296 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \ |
emilmont | 77:869cf507173a | 297 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \ |
emilmont | 77:869cf507173a | 298 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \ |
emilmont | 77:869cf507173a | 299 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC2) || \ |
emilmont | 77:869cf507173a | 300 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \ |
emilmont | 77:869cf507173a | 301 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC1) || \ |
emilmont | 77:869cf507173a | 302 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC2) || \ |
emilmont | 77:869cf507173a | 303 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \ |
emilmont | 77:869cf507173a | 304 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \ |
emilmont | 77:869cf507173a | 305 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_CC4) || \ |
emilmont | 77:869cf507173a | 306 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \ |
emilmont | 77:869cf507173a | 307 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \ |
emilmont | 77:869cf507173a | 308 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC3) || \ |
emilmont | 77:869cf507173a | 309 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \ |
Kojto | 106:ba1f97679dad | 310 | ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15)|| \ |
Kojto | 106:ba1f97679dad | 311 | ((INJTRIG) == ADC_INJECTED_SOFTWARE_START)) |
emilmont | 77:869cf507173a | 312 | #define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4))) |
emilmont | 77:869cf507173a | 313 | #define IS_ADC_INJECTED_RANK(RANK) (((RANK) >= ((uint32_t)1)) && ((RANK) <= ((uint32_t)4))) |
emilmont | 77:869cf507173a | 314 | |
emilmont | 77:869cf507173a | 315 | /** |
emilmont | 77:869cf507173a | 316 | * @brief Set the selected injected Channel rank. |
emilmont | 77:869cf507173a | 317 | * @param _CHANNELNB_: Channel number. |
emilmont | 77:869cf507173a | 318 | * @param _RANKNB_: Rank number. |
emilmont | 77:869cf507173a | 319 | * @param _JSQR_JL_: Sequence length. |
emilmont | 77:869cf507173a | 320 | * @retval None |
emilmont | 77:869cf507173a | 321 | */ |
Kojto | 99:dbbf35b96557 | 322 | #define ADC_JSQR(_CHANNELNB_, _RANKNB_, _JSQR_JL_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * (uint8_t)(((_RANKNB_) + 3) - (_JSQR_JL_)))) |
emilmont | 77:869cf507173a | 323 | |
Kojto | 99:dbbf35b96557 | 324 | /** |
Kojto | 99:dbbf35b96557 | 325 | * @} |
Kojto | 99:dbbf35b96557 | 326 | */ |
emilmont | 77:869cf507173a | 327 | |
Kojto | 99:dbbf35b96557 | 328 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 329 | /** @defgroup ADCEx_Private_Functions ADC Private Functions |
Kojto | 99:dbbf35b96557 | 330 | * @{ |
Kojto | 99:dbbf35b96557 | 331 | */ |
emilmont | 77:869cf507173a | 332 | |
Kojto | 99:dbbf35b96557 | 333 | /** |
Kojto | 99:dbbf35b96557 | 334 | * @} |
Kojto | 99:dbbf35b96557 | 335 | */ |
emilmont | 77:869cf507173a | 336 | |
emilmont | 77:869cf507173a | 337 | /** |
emilmont | 77:869cf507173a | 338 | * @} |
emilmont | 77:869cf507173a | 339 | */ |
emilmont | 77:869cf507173a | 340 | |
emilmont | 77:869cf507173a | 341 | /** |
emilmont | 77:869cf507173a | 342 | * @} |
emilmont | 77:869cf507173a | 343 | */ |
emilmont | 77:869cf507173a | 344 | |
emilmont | 77:869cf507173a | 345 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 346 | } |
emilmont | 77:869cf507173a | 347 | #endif |
emilmont | 77:869cf507173a | 348 | |
emilmont | 77:869cf507173a | 349 | #endif /*__STM32F4xx_ADC_EX_H */ |
emilmont | 77:869cf507173a | 350 | |
emilmont | 77:869cf507173a | 351 | |
emilmont | 77:869cf507173a | 352 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |