meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 13 08:08:21 2015 +0200
Revision:
99:dbbf35b96557
Parent:
92:4fc01daae5a5
Child:
106:ba1f97679dad
Release 99 of the mbed library

Changes:
- new targets - MAXWSNENV, DISCO_L053C8
- STM32F4xx - ST Cube driver
- KSDK mcu - SPI timing fix
- Nordic - update to softdevice s130

Who changed what in which revision?

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