mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_adc.h@235:685d5f11838f, 2014-06-23 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jun 23 14:00:09 2014 +0100
- Revision:
- 235:685d5f11838f
Synchronized with git revision 9728c76667962b289ee9c4c687ef9f115db48cd3
Full URL: https://github.com/mbedmicro/mbed/commit/9728c76667962b289ee9c4c687ef9f115db48cd3/
[NUCLEO_F411RE] Add all target files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_adc.h |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief Header file of ADC HAL extension module. |
mbed_official | 235:685d5f11838f | 8 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 9 | * @attention |
mbed_official | 235:685d5f11838f | 10 | * |
mbed_official | 235:685d5f11838f | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 12 | * |
mbed_official | 235:685d5f11838f | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 19 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 22 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 23 | * |
mbed_official | 235:685d5f11838f | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 36 | */ |
mbed_official | 235:685d5f11838f | 37 | |
mbed_official | 235:685d5f11838f | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 235:685d5f11838f | 39 | #ifndef __STM32F4xx_ADC_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_ADC_H |
mbed_official | 235:685d5f11838f | 41 | |
mbed_official | 235:685d5f11838f | 42 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 43 | extern "C" { |
mbed_official | 235:685d5f11838f | 44 | #endif |
mbed_official | 235:685d5f11838f | 45 | |
mbed_official | 235:685d5f11838f | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 47 | #include "stm32f4xx_hal_def.h" |
mbed_official | 235:685d5f11838f | 48 | |
mbed_official | 235:685d5f11838f | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 50 | * @{ |
mbed_official | 235:685d5f11838f | 51 | */ |
mbed_official | 235:685d5f11838f | 52 | |
mbed_official | 235:685d5f11838f | 53 | /** @addtogroup ADC |
mbed_official | 235:685d5f11838f | 54 | * @{ |
mbed_official | 235:685d5f11838f | 55 | */ |
mbed_official | 235:685d5f11838f | 56 | |
mbed_official | 235:685d5f11838f | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 58 | |
mbed_official | 235:685d5f11838f | 59 | /** |
mbed_official | 235:685d5f11838f | 60 | * @brief HAL State structures definition |
mbed_official | 235:685d5f11838f | 61 | */ |
mbed_official | 235:685d5f11838f | 62 | typedef enum |
mbed_official | 235:685d5f11838f | 63 | { |
mbed_official | 235:685d5f11838f | 64 | HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */ |
mbed_official | 235:685d5f11838f | 65 | HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */ |
mbed_official | 235:685d5f11838f | 66 | HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */ |
mbed_official | 235:685d5f11838f | 67 | HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */ |
mbed_official | 235:685d5f11838f | 68 | HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */ |
mbed_official | 235:685d5f11838f | 69 | HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */ |
mbed_official | 235:685d5f11838f | 70 | HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
mbed_official | 235:685d5f11838f | 71 | HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */ |
mbed_official | 235:685d5f11838f | 72 | HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */ |
mbed_official | 235:685d5f11838f | 73 | HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */ |
mbed_official | 235:685d5f11838f | 74 | HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */ |
mbed_official | 235:685d5f11838f | 75 | HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */ |
mbed_official | 235:685d5f11838f | 76 | HAL_ADC_STATE_AWD = 0x06 /*!< ADC state analog watchdog */ |
mbed_official | 235:685d5f11838f | 77 | |
mbed_official | 235:685d5f11838f | 78 | }HAL_ADC_StateTypeDef; |
mbed_official | 235:685d5f11838f | 79 | |
mbed_official | 235:685d5f11838f | 80 | /** |
mbed_official | 235:685d5f11838f | 81 | * @brief ADC Init structure definition |
mbed_official | 235:685d5f11838f | 82 | */ |
mbed_official | 235:685d5f11838f | 83 | typedef struct |
mbed_official | 235:685d5f11838f | 84 | { |
mbed_official | 235:685d5f11838f | 85 | uint32_t ClockPrescaler; /*!< Select the frequency of the clock to the ADC. The clock is common for |
mbed_official | 235:685d5f11838f | 86 | all the ADCs. |
mbed_official | 235:685d5f11838f | 87 | This parameter can be a value of @ref ADC_ClockPrescaler */ |
mbed_official | 235:685d5f11838f | 88 | uint32_t Resolution; /*!< Configures the ADC resolution dual mode. |
mbed_official | 235:685d5f11838f | 89 | This parameter can be a value of @ref ADC_Resolution */ |
mbed_official | 235:685d5f11838f | 90 | uint32_t DataAlign; /*!< Specifies whether the ADC data alignment is left or right. |
mbed_official | 235:685d5f11838f | 91 | This parameter can be a value of @ref ADC_data_align */ |
mbed_official | 235:685d5f11838f | 92 | uint32_t ScanConvMode; /*!< Specifies whether the conversion is performed in Scan (multi channels) or |
mbed_official | 235:685d5f11838f | 93 | Single (one channel) mode. |
mbed_official | 235:685d5f11838f | 94 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 95 | uint32_t EOCSelection; /*!< Specifies whether the EOC flag is set |
mbed_official | 235:685d5f11838f | 96 | at the end of single channel conversion or at the end of all conversions. |
mbed_official | 235:685d5f11838f | 97 | This parameter can be a value of @ref ADC_EOCSelection */ |
mbed_official | 235:685d5f11838f | 98 | uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in Continuous or Single mode. |
mbed_official | 235:685d5f11838f | 99 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 235:685d5f11838f | 100 | uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests is performed in Continuous or in Single mode. |
mbed_official | 235:685d5f11838f | 101 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 235:685d5f11838f | 102 | uint32_t NbrOfConversion; /*!< Specifies the number of ADC conversions that will be done using the sequencer for |
mbed_official | 235:685d5f11838f | 103 | regular channel group. |
mbed_official | 235:685d5f11838f | 104 | This parameter must be a number between Min_Data = 1 and Max_Data = 16. */ |
mbed_official | 235:685d5f11838f | 105 | uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversion is performed in Discontinuous or not |
mbed_official | 235:685d5f11838f | 106 | for regular channels. |
mbed_official | 235:685d5f11838f | 107 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 235:685d5f11838f | 108 | uint32_t NbrOfDiscConversion; /*!< Specifies the number of ADC discontinuous conversions that will be done |
mbed_official | 235:685d5f11838f | 109 | using the sequencer for regular channel group. |
mbed_official | 235:685d5f11838f | 110 | This parameter must be a number between Min_Data = 1 and Max_Data = 8. */ |
mbed_official | 235:685d5f11838f | 111 | uint32_t ExternalTrigConvEdge; /*!< Select the external trigger edge and enable the trigger of a regular group. |
mbed_official | 235:685d5f11838f | 112 | This parameter can be a value of @ref ADC_External_trigger_edge_Regular */ |
mbed_official | 235:685d5f11838f | 113 | uint32_t ExternalTrigConv; /*!< Select the external event used to trigger the start of conversion of a regular group. |
mbed_official | 235:685d5f11838f | 114 | This parameter can be a value of @ref ADC_External_trigger_Source_Regular */ |
mbed_official | 235:685d5f11838f | 115 | }ADC_InitTypeDef; |
mbed_official | 235:685d5f11838f | 116 | |
mbed_official | 235:685d5f11838f | 117 | /** |
mbed_official | 235:685d5f11838f | 118 | * @brief ADC handle Structure definition |
mbed_official | 235:685d5f11838f | 119 | */ |
mbed_official | 235:685d5f11838f | 120 | typedef struct |
mbed_official | 235:685d5f11838f | 121 | { |
mbed_official | 235:685d5f11838f | 122 | ADC_TypeDef *Instance; /*!< Register base address */ |
mbed_official | 235:685d5f11838f | 123 | |
mbed_official | 235:685d5f11838f | 124 | ADC_InitTypeDef Init; /*!< ADC required parameters */ |
mbed_official | 235:685d5f11838f | 125 | |
mbed_official | 235:685d5f11838f | 126 | __IO uint32_t NbrOfCurrentConversionRank; /*!< ADC number of current conversion rank */ |
mbed_official | 235:685d5f11838f | 127 | |
mbed_official | 235:685d5f11838f | 128 | DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */ |
mbed_official | 235:685d5f11838f | 129 | |
mbed_official | 235:685d5f11838f | 130 | HAL_LockTypeDef Lock; /*!< ADC locking object */ |
mbed_official | 235:685d5f11838f | 131 | |
mbed_official | 235:685d5f11838f | 132 | __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */ |
mbed_official | 235:685d5f11838f | 133 | |
mbed_official | 235:685d5f11838f | 134 | __IO uint32_t ErrorCode; /*!< ADC Error code */ |
mbed_official | 235:685d5f11838f | 135 | }ADC_HandleTypeDef; |
mbed_official | 235:685d5f11838f | 136 | |
mbed_official | 235:685d5f11838f | 137 | /** |
mbed_official | 235:685d5f11838f | 138 | * @brief ADC Configuration regular Channel structure definition |
mbed_official | 235:685d5f11838f | 139 | */ |
mbed_official | 235:685d5f11838f | 140 | typedef struct |
mbed_official | 235:685d5f11838f | 141 | { |
mbed_official | 235:685d5f11838f | 142 | uint32_t Channel; /*!< The ADC channel to configure. |
mbed_official | 235:685d5f11838f | 143 | This parameter can be a value of @ref ADC_channels */ |
mbed_official | 235:685d5f11838f | 144 | uint32_t Rank; /*!< The rank in the regular group sequencer. |
mbed_official | 235:685d5f11838f | 145 | This parameter must be a number between Min_Data = 1 and Max_Data = 16 */ |
mbed_official | 235:685d5f11838f | 146 | uint32_t SamplingTime; /*!< The sample time value to be set for the selected channel. |
mbed_official | 235:685d5f11838f | 147 | This parameter can be a value of @ref ADC_sampling_times */ |
mbed_official | 235:685d5f11838f | 148 | uint32_t Offset; /*!< Reserved for future use, can be set to 0 */ |
mbed_official | 235:685d5f11838f | 149 | }ADC_ChannelConfTypeDef; |
mbed_official | 235:685d5f11838f | 150 | |
mbed_official | 235:685d5f11838f | 151 | /** |
mbed_official | 235:685d5f11838f | 152 | * @brief ADC Configuration multi-mode structure definition |
mbed_official | 235:685d5f11838f | 153 | */ |
mbed_official | 235:685d5f11838f | 154 | typedef struct |
mbed_official | 235:685d5f11838f | 155 | { |
mbed_official | 235:685d5f11838f | 156 | uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode. |
mbed_official | 235:685d5f11838f | 157 | This parameter can be a value of @ref ADC_analog_watchdog_selection */ |
mbed_official | 235:685d5f11838f | 158 | uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 235:685d5f11838f | 159 | This parameter must be a 12-bit value. */ |
mbed_official | 235:685d5f11838f | 160 | uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value. |
mbed_official | 235:685d5f11838f | 161 | This parameter must be a 12-bit value. */ |
mbed_official | 235:685d5f11838f | 162 | uint32_t Channel; /*!< Configures ADC channel for the analog watchdog. |
mbed_official | 235:685d5f11838f | 163 | This parameter has an effect only if watchdog mode is configured on single channel |
mbed_official | 235:685d5f11838f | 164 | This parameter can be a value of @ref ADC_channels */ |
mbed_official | 235:685d5f11838f | 165 | uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured |
mbed_official | 235:685d5f11838f | 166 | is interrupt mode or in polling mode. |
mbed_official | 235:685d5f11838f | 167 | This parameter can be set to ENABLE or DISABLE */ |
mbed_official | 235:685d5f11838f | 168 | uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */ |
mbed_official | 235:685d5f11838f | 169 | }ADC_AnalogWDGConfTypeDef; |
mbed_official | 235:685d5f11838f | 170 | |
mbed_official | 235:685d5f11838f | 171 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 172 | |
mbed_official | 235:685d5f11838f | 173 | /** @defgroup ADC_Exported_Constants |
mbed_official | 235:685d5f11838f | 174 | * @{ |
mbed_official | 235:685d5f11838f | 175 | */ |
mbed_official | 235:685d5f11838f | 176 | |
mbed_official | 235:685d5f11838f | 177 | |
mbed_official | 235:685d5f11838f | 178 | /** @defgroup ADC_Error_Code |
mbed_official | 235:685d5f11838f | 179 | * @{ |
mbed_official | 235:685d5f11838f | 180 | */ |
mbed_official | 235:685d5f11838f | 181 | |
mbed_official | 235:685d5f11838f | 182 | #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */ |
mbed_official | 235:685d5f11838f | 183 | #define HAL_ADC_ERROR_OVR ((uint32_t)0x01) /*!< OVR error */ |
mbed_official | 235:685d5f11838f | 184 | #define HAL_ADC_ERROR_DMA ((uint32_t)0x02) /*!< DMA transfer error */ |
mbed_official | 235:685d5f11838f | 185 | /** |
mbed_official | 235:685d5f11838f | 186 | * @} |
mbed_official | 235:685d5f11838f | 187 | */ |
mbed_official | 235:685d5f11838f | 188 | |
mbed_official | 235:685d5f11838f | 189 | |
mbed_official | 235:685d5f11838f | 190 | /** @defgroup ADC_ClockPrescaler |
mbed_official | 235:685d5f11838f | 191 | * @{ |
mbed_official | 235:685d5f11838f | 192 | */ |
mbed_official | 235:685d5f11838f | 193 | #define ADC_CLOCKPRESCALER_PCLK_DIV2 ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 194 | #define ADC_CLOCKPRESCALER_PCLK_DIV4 ((uint32_t)ADC_CCR_ADCPRE_0) |
mbed_official | 235:685d5f11838f | 195 | #define ADC_CLOCKPRESCALER_PCLK_DIV6 ((uint32_t)ADC_CCR_ADCPRE_1) |
mbed_official | 235:685d5f11838f | 196 | #define ADC_CLOCKPRESCALER_PCLK_DIV8 ((uint32_t)ADC_CCR_ADCPRE) |
mbed_official | 235:685d5f11838f | 197 | #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV2) || \ |
mbed_official | 235:685d5f11838f | 198 | ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV4) || \ |
mbed_official | 235:685d5f11838f | 199 | ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV6) || \ |
mbed_official | 235:685d5f11838f | 200 | ((ADC_CLOCK) == ADC_CLOCKPRESCALER_PCLK_DIV8)) |
mbed_official | 235:685d5f11838f | 201 | /** |
mbed_official | 235:685d5f11838f | 202 | * @} |
mbed_official | 235:685d5f11838f | 203 | */ |
mbed_official | 235:685d5f11838f | 204 | |
mbed_official | 235:685d5f11838f | 205 | /** @defgroup ADC_delay_between_2_sampling_phases |
mbed_official | 235:685d5f11838f | 206 | * @{ |
mbed_official | 235:685d5f11838f | 207 | */ |
mbed_official | 235:685d5f11838f | 208 | #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 209 | #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)ADC_CCR_DELAY_0) |
mbed_official | 235:685d5f11838f | 210 | #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)ADC_CCR_DELAY_1) |
mbed_official | 235:685d5f11838f | 211 | #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 212 | #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)ADC_CCR_DELAY_2) |
mbed_official | 235:685d5f11838f | 213 | #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 214 | #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1)) |
mbed_official | 235:685d5f11838f | 215 | #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 216 | #define ADC_TWOSAMPLINGDELAY_13CYCLES ((uint32_t)ADC_CCR_DELAY_3) |
mbed_official | 235:685d5f11838f | 217 | #define ADC_TWOSAMPLINGDELAY_14CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 218 | #define ADC_TWOSAMPLINGDELAY_15CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1)) |
mbed_official | 235:685d5f11838f | 219 | #define ADC_TWOSAMPLINGDELAY_16CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 220 | #define ADC_TWOSAMPLINGDELAY_17CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2)) |
mbed_official | 235:685d5f11838f | 221 | #define ADC_TWOSAMPLINGDELAY_18CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0)) |
mbed_official | 235:685d5f11838f | 222 | #define ADC_TWOSAMPLINGDELAY_19CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1)) |
mbed_official | 235:685d5f11838f | 223 | #define ADC_TWOSAMPLINGDELAY_20CYCLES ((uint32_t)ADC_CCR_DELAY) |
mbed_official | 235:685d5f11838f | 224 | |
mbed_official | 235:685d5f11838f | 225 | #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \ |
mbed_official | 235:685d5f11838f | 226 | ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \ |
mbed_official | 235:685d5f11838f | 227 | ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \ |
mbed_official | 235:685d5f11838f | 228 | ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \ |
mbed_official | 235:685d5f11838f | 229 | ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \ |
mbed_official | 235:685d5f11838f | 230 | ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \ |
mbed_official | 235:685d5f11838f | 231 | ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \ |
mbed_official | 235:685d5f11838f | 232 | ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) || \ |
mbed_official | 235:685d5f11838f | 233 | ((DELAY) == ADC_TWOSAMPLINGDELAY_13CYCLES) || \ |
mbed_official | 235:685d5f11838f | 234 | ((DELAY) == ADC_TWOSAMPLINGDELAY_14CYCLES) || \ |
mbed_official | 235:685d5f11838f | 235 | ((DELAY) == ADC_TWOSAMPLINGDELAY_15CYCLES) || \ |
mbed_official | 235:685d5f11838f | 236 | ((DELAY) == ADC_TWOSAMPLINGDELAY_16CYCLES) || \ |
mbed_official | 235:685d5f11838f | 237 | ((DELAY) == ADC_TWOSAMPLINGDELAY_17CYCLES) || \ |
mbed_official | 235:685d5f11838f | 238 | ((DELAY) == ADC_TWOSAMPLINGDELAY_18CYCLES) || \ |
mbed_official | 235:685d5f11838f | 239 | ((DELAY) == ADC_TWOSAMPLINGDELAY_19CYCLES) || \ |
mbed_official | 235:685d5f11838f | 240 | ((DELAY) == ADC_TWOSAMPLINGDELAY_20CYCLES)) |
mbed_official | 235:685d5f11838f | 241 | /** |
mbed_official | 235:685d5f11838f | 242 | * @} |
mbed_official | 235:685d5f11838f | 243 | */ |
mbed_official | 235:685d5f11838f | 244 | |
mbed_official | 235:685d5f11838f | 245 | /** @defgroup ADC_Resolution |
mbed_official | 235:685d5f11838f | 246 | * @{ |
mbed_official | 235:685d5f11838f | 247 | */ |
mbed_official | 235:685d5f11838f | 248 | #define ADC_RESOLUTION12b ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 249 | #define ADC_RESOLUTION10b ((uint32_t)ADC_CR1_RES_0) |
mbed_official | 235:685d5f11838f | 250 | #define ADC_RESOLUTION8b ((uint32_t)ADC_CR1_RES_1) |
mbed_official | 235:685d5f11838f | 251 | #define ADC_RESOLUTION6b ((uint32_t)ADC_CR1_RES) |
mbed_official | 235:685d5f11838f | 252 | |
mbed_official | 235:685d5f11838f | 253 | #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION12b) || \ |
mbed_official | 235:685d5f11838f | 254 | ((RESOLUTION) == ADC_RESOLUTION10b) || \ |
mbed_official | 235:685d5f11838f | 255 | ((RESOLUTION) == ADC_RESOLUTION8b) || \ |
mbed_official | 235:685d5f11838f | 256 | ((RESOLUTION) == ADC_RESOLUTION6b)) |
mbed_official | 235:685d5f11838f | 257 | /** |
mbed_official | 235:685d5f11838f | 258 | * @} |
mbed_official | 235:685d5f11838f | 259 | */ |
mbed_official | 235:685d5f11838f | 260 | |
mbed_official | 235:685d5f11838f | 261 | /** @defgroup ADC_External_trigger_edge_Regular |
mbed_official | 235:685d5f11838f | 262 | * @{ |
mbed_official | 235:685d5f11838f | 263 | */ |
mbed_official | 235:685d5f11838f | 264 | #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 265 | #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTEN_0) |
mbed_official | 235:685d5f11838f | 266 | #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CR2_EXTEN_1) |
mbed_official | 235:685d5f11838f | 267 | #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_EXTEN) |
mbed_official | 235:685d5f11838f | 268 | |
mbed_official | 235:685d5f11838f | 269 | #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \ |
mbed_official | 235:685d5f11838f | 270 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \ |
mbed_official | 235:685d5f11838f | 271 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \ |
mbed_official | 235:685d5f11838f | 272 | ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING)) |
mbed_official | 235:685d5f11838f | 273 | /** |
mbed_official | 235:685d5f11838f | 274 | * @} |
mbed_official | 235:685d5f11838f | 275 | */ |
mbed_official | 235:685d5f11838f | 276 | |
mbed_official | 235:685d5f11838f | 277 | /** @defgroup ADC_External_trigger_Source_Regular |
mbed_official | 235:685d5f11838f | 278 | * @{ |
mbed_official | 235:685d5f11838f | 279 | */ |
mbed_official | 235:685d5f11838f | 280 | #define ADC_EXTERNALTRIGCONV_T1_CC1 ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 281 | #define ADC_EXTERNALTRIGCONV_T1_CC2 ((uint32_t)ADC_CR2_EXTSEL_0) |
mbed_official | 235:685d5f11838f | 282 | #define ADC_EXTERNALTRIGCONV_T1_CC3 ((uint32_t)ADC_CR2_EXTSEL_1) |
mbed_official | 235:685d5f11838f | 283 | #define ADC_EXTERNALTRIGCONV_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 284 | #define ADC_EXTERNALTRIGCONV_T2_CC3 ((uint32_t)ADC_CR2_EXTSEL_2) |
mbed_official | 235:685d5f11838f | 285 | #define ADC_EXTERNALTRIGCONV_T2_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 286 | #define ADC_EXTERNALTRIGCONV_T2_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1)) |
mbed_official | 235:685d5f11838f | 287 | #define ADC_EXTERNALTRIGCONV_T3_CC1 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 288 | #define ADC_EXTERNALTRIGCONV_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_3) |
mbed_official | 235:685d5f11838f | 289 | #define ADC_EXTERNALTRIGCONV_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 290 | #define ADC_EXTERNALTRIGCONV_T5_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1)) |
mbed_official | 235:685d5f11838f | 291 | #define ADC_EXTERNALTRIGCONV_T5_CC2 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 292 | #define ADC_EXTERNALTRIGCONV_T5_CC3 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2)) |
mbed_official | 235:685d5f11838f | 293 | #define ADC_EXTERNALTRIGCONV_T8_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0)) |
mbed_official | 235:685d5f11838f | 294 | #define ADC_EXTERNALTRIGCONV_T8_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1)) |
mbed_official | 235:685d5f11838f | 295 | #define ADC_EXTERNALTRIGCONV_Ext_IT11 ((uint32_t)ADC_CR2_EXTSEL) |
mbed_official | 235:685d5f11838f | 296 | |
mbed_official | 235:685d5f11838f | 297 | #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \ |
mbed_official | 235:685d5f11838f | 298 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \ |
mbed_official | 235:685d5f11838f | 299 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \ |
mbed_official | 235:685d5f11838f | 300 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \ |
mbed_official | 235:685d5f11838f | 301 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \ |
mbed_official | 235:685d5f11838f | 302 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC4) || \ |
mbed_official | 235:685d5f11838f | 303 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \ |
mbed_official | 235:685d5f11838f | 304 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \ |
mbed_official | 235:685d5f11838f | 305 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \ |
mbed_official | 235:685d5f11838f | 306 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \ |
mbed_official | 235:685d5f11838f | 307 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \ |
mbed_official | 235:685d5f11838f | 308 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC2) || \ |
mbed_official | 235:685d5f11838f | 309 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \ |
mbed_official | 235:685d5f11838f | 310 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \ |
mbed_official | 235:685d5f11838f | 311 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \ |
mbed_official | 235:685d5f11838f | 312 | ((REGTRIG) == ADC_EXTERNALTRIGCONV_Ext_IT11)) |
mbed_official | 235:685d5f11838f | 313 | /** |
mbed_official | 235:685d5f11838f | 314 | * @} |
mbed_official | 235:685d5f11838f | 315 | */ |
mbed_official | 235:685d5f11838f | 316 | |
mbed_official | 235:685d5f11838f | 317 | /** @defgroup ADC_data_align |
mbed_official | 235:685d5f11838f | 318 | * @{ |
mbed_official | 235:685d5f11838f | 319 | */ |
mbed_official | 235:685d5f11838f | 320 | #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 321 | #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN) |
mbed_official | 235:685d5f11838f | 322 | |
mbed_official | 235:685d5f11838f | 323 | #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \ |
mbed_official | 235:685d5f11838f | 324 | ((ALIGN) == ADC_DATAALIGN_LEFT)) |
mbed_official | 235:685d5f11838f | 325 | /** |
mbed_official | 235:685d5f11838f | 326 | * @} |
mbed_official | 235:685d5f11838f | 327 | */ |
mbed_official | 235:685d5f11838f | 328 | |
mbed_official | 235:685d5f11838f | 329 | /** @defgroup ADC_channels |
mbed_official | 235:685d5f11838f | 330 | * @{ |
mbed_official | 235:685d5f11838f | 331 | */ |
mbed_official | 235:685d5f11838f | 332 | #define ADC_CHANNEL_0 ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 333 | #define ADC_CHANNEL_1 ((uint32_t)ADC_CR1_AWDCH_0) |
mbed_official | 235:685d5f11838f | 334 | #define ADC_CHANNEL_2 ((uint32_t)ADC_CR1_AWDCH_1) |
mbed_official | 235:685d5f11838f | 335 | #define ADC_CHANNEL_3 ((uint32_t)(ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 336 | #define ADC_CHANNEL_4 ((uint32_t)ADC_CR1_AWDCH_2) |
mbed_official | 235:685d5f11838f | 337 | #define ADC_CHANNEL_5 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 338 | #define ADC_CHANNEL_6 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1)) |
mbed_official | 235:685d5f11838f | 339 | #define ADC_CHANNEL_7 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 340 | #define ADC_CHANNEL_8 ((uint32_t)ADC_CR1_AWDCH_3) |
mbed_official | 235:685d5f11838f | 341 | #define ADC_CHANNEL_9 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 342 | #define ADC_CHANNEL_10 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1)) |
mbed_official | 235:685d5f11838f | 343 | #define ADC_CHANNEL_11 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 344 | #define ADC_CHANNEL_12 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2)) |
mbed_official | 235:685d5f11838f | 345 | #define ADC_CHANNEL_13 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 346 | #define ADC_CHANNEL_14 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1)) |
mbed_official | 235:685d5f11838f | 347 | #define ADC_CHANNEL_15 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 348 | #define ADC_CHANNEL_16 ((uint32_t)ADC_CR1_AWDCH_4) |
mbed_official | 235:685d5f11838f | 349 | #define ADC_CHANNEL_17 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_0)) |
mbed_official | 235:685d5f11838f | 350 | #define ADC_CHANNEL_18 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_1)) |
mbed_official | 235:685d5f11838f | 351 | |
mbed_official | 235:685d5f11838f | 352 | #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_16) |
mbed_official | 235:685d5f11838f | 353 | #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_17) |
mbed_official | 235:685d5f11838f | 354 | #define ADC_CHANNEL_VBAT ((uint32_t)ADC_CHANNEL_18) |
mbed_official | 235:685d5f11838f | 355 | |
mbed_official | 235:685d5f11838f | 356 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \ |
mbed_official | 235:685d5f11838f | 357 | ((CHANNEL) == ADC_CHANNEL_1) || \ |
mbed_official | 235:685d5f11838f | 358 | ((CHANNEL) == ADC_CHANNEL_2) || \ |
mbed_official | 235:685d5f11838f | 359 | ((CHANNEL) == ADC_CHANNEL_3) || \ |
mbed_official | 235:685d5f11838f | 360 | ((CHANNEL) == ADC_CHANNEL_4) || \ |
mbed_official | 235:685d5f11838f | 361 | ((CHANNEL) == ADC_CHANNEL_5) || \ |
mbed_official | 235:685d5f11838f | 362 | ((CHANNEL) == ADC_CHANNEL_6) || \ |
mbed_official | 235:685d5f11838f | 363 | ((CHANNEL) == ADC_CHANNEL_7) || \ |
mbed_official | 235:685d5f11838f | 364 | ((CHANNEL) == ADC_CHANNEL_8) || \ |
mbed_official | 235:685d5f11838f | 365 | ((CHANNEL) == ADC_CHANNEL_9) || \ |
mbed_official | 235:685d5f11838f | 366 | ((CHANNEL) == ADC_CHANNEL_10) || \ |
mbed_official | 235:685d5f11838f | 367 | ((CHANNEL) == ADC_CHANNEL_11) || \ |
mbed_official | 235:685d5f11838f | 368 | ((CHANNEL) == ADC_CHANNEL_12) || \ |
mbed_official | 235:685d5f11838f | 369 | ((CHANNEL) == ADC_CHANNEL_13) || \ |
mbed_official | 235:685d5f11838f | 370 | ((CHANNEL) == ADC_CHANNEL_14) || \ |
mbed_official | 235:685d5f11838f | 371 | ((CHANNEL) == ADC_CHANNEL_15) || \ |
mbed_official | 235:685d5f11838f | 372 | ((CHANNEL) == ADC_CHANNEL_16) || \ |
mbed_official | 235:685d5f11838f | 373 | ((CHANNEL) == ADC_CHANNEL_17) || \ |
mbed_official | 235:685d5f11838f | 374 | ((CHANNEL) == ADC_CHANNEL_18)) |
mbed_official | 235:685d5f11838f | 375 | /** |
mbed_official | 235:685d5f11838f | 376 | * @} |
mbed_official | 235:685d5f11838f | 377 | */ |
mbed_official | 235:685d5f11838f | 378 | |
mbed_official | 235:685d5f11838f | 379 | /** @defgroup ADC_sampling_times |
mbed_official | 235:685d5f11838f | 380 | * @{ |
mbed_official | 235:685d5f11838f | 381 | */ |
mbed_official | 235:685d5f11838f | 382 | #define ADC_SAMPLETIME_3CYCLES ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 383 | #define ADC_SAMPLETIME_15CYCLES ((uint32_t)ADC_SMPR1_SMP10_0) |
mbed_official | 235:685d5f11838f | 384 | #define ADC_SAMPLETIME_28CYCLES ((uint32_t)ADC_SMPR1_SMP10_1) |
mbed_official | 235:685d5f11838f | 385 | #define ADC_SAMPLETIME_56CYCLES ((uint32_t)(ADC_SMPR1_SMP10_1 | ADC_SMPR1_SMP10_0)) |
mbed_official | 235:685d5f11838f | 386 | #define ADC_SAMPLETIME_84CYCLES ((uint32_t)ADC_SMPR1_SMP10_2) |
mbed_official | 235:685d5f11838f | 387 | #define ADC_SAMPLETIME_112CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_0)) |
mbed_official | 235:685d5f11838f | 388 | #define ADC_SAMPLETIME_144CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_1)) |
mbed_official | 235:685d5f11838f | 389 | #define ADC_SAMPLETIME_480CYCLES ((uint32_t)ADC_SMPR1_SMP10) |
mbed_official | 235:685d5f11838f | 390 | |
mbed_official | 235:685d5f11838f | 391 | #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_3CYCLES) || \ |
mbed_official | 235:685d5f11838f | 392 | ((TIME) == ADC_SAMPLETIME_15CYCLES) || \ |
mbed_official | 235:685d5f11838f | 393 | ((TIME) == ADC_SAMPLETIME_28CYCLES) || \ |
mbed_official | 235:685d5f11838f | 394 | ((TIME) == ADC_SAMPLETIME_56CYCLES) || \ |
mbed_official | 235:685d5f11838f | 395 | ((TIME) == ADC_SAMPLETIME_84CYCLES) || \ |
mbed_official | 235:685d5f11838f | 396 | ((TIME) == ADC_SAMPLETIME_112CYCLES) || \ |
mbed_official | 235:685d5f11838f | 397 | ((TIME) == ADC_SAMPLETIME_144CYCLES) || \ |
mbed_official | 235:685d5f11838f | 398 | ((TIME) == ADC_SAMPLETIME_480CYCLES)) |
mbed_official | 235:685d5f11838f | 399 | /** |
mbed_official | 235:685d5f11838f | 400 | * @} |
mbed_official | 235:685d5f11838f | 401 | */ |
mbed_official | 235:685d5f11838f | 402 | |
mbed_official | 235:685d5f11838f | 403 | /** @defgroup ADC_EOCSelection |
mbed_official | 235:685d5f11838f | 404 | * @{ |
mbed_official | 235:685d5f11838f | 405 | */ |
mbed_official | 235:685d5f11838f | 406 | #define EOC_SEQ_CONV ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 407 | #define EOC_SINGLE_CONV ((uint32_t)0x00000001) |
mbed_official | 235:685d5f11838f | 408 | #define EOC_SINGLE_SEQ_CONV ((uint32_t)0x00000002) /*!< reserved for future use */ |
mbed_official | 235:685d5f11838f | 409 | |
mbed_official | 235:685d5f11838f | 410 | #define IS_ADC_EOCSelection(EOCSelection) (((EOCSelection) == EOC_SINGLE_CONV) || \ |
mbed_official | 235:685d5f11838f | 411 | ((EOCSelection) == EOC_SEQ_CONV) || \ |
mbed_official | 235:685d5f11838f | 412 | ((EOCSelection) == EOC_SINGLE_SEQ_CONV)) |
mbed_official | 235:685d5f11838f | 413 | /** |
mbed_official | 235:685d5f11838f | 414 | * @} |
mbed_official | 235:685d5f11838f | 415 | */ |
mbed_official | 235:685d5f11838f | 416 | |
mbed_official | 235:685d5f11838f | 417 | /** @defgroup ADC_Event_type |
mbed_official | 235:685d5f11838f | 418 | * @{ |
mbed_official | 235:685d5f11838f | 419 | */ |
mbed_official | 235:685d5f11838f | 420 | #define AWD_EVENT ((uint32_t)ADC_FLAG_AWD) |
mbed_official | 235:685d5f11838f | 421 | #define OVR_EVENT ((uint32_t)ADC_FLAG_OVR) |
mbed_official | 235:685d5f11838f | 422 | |
mbed_official | 235:685d5f11838f | 423 | #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == AWD_EVENT) || \ |
mbed_official | 235:685d5f11838f | 424 | ((EVENT) == OVR_EVENT)) |
mbed_official | 235:685d5f11838f | 425 | /** |
mbed_official | 235:685d5f11838f | 426 | * @} |
mbed_official | 235:685d5f11838f | 427 | */ |
mbed_official | 235:685d5f11838f | 428 | |
mbed_official | 235:685d5f11838f | 429 | /** @defgroup ADC_analog_watchdog_selection |
mbed_official | 235:685d5f11838f | 430 | * @{ |
mbed_official | 235:685d5f11838f | 431 | */ |
mbed_official | 235:685d5f11838f | 432 | #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN)) |
mbed_official | 235:685d5f11838f | 433 | #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN)) |
mbed_official | 235:685d5f11838f | 434 | #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN)) |
mbed_official | 235:685d5f11838f | 435 | #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t)ADC_CR1_AWDEN) |
mbed_official | 235:685d5f11838f | 436 | #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t)ADC_CR1_JAWDEN) |
mbed_official | 235:685d5f11838f | 437 | #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN)) |
mbed_official | 235:685d5f11838f | 438 | #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000) |
mbed_official | 235:685d5f11838f | 439 | |
mbed_official | 235:685d5f11838f | 440 | #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \ |
mbed_official | 235:685d5f11838f | 441 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \ |
mbed_official | 235:685d5f11838f | 442 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \ |
mbed_official | 235:685d5f11838f | 443 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \ |
mbed_official | 235:685d5f11838f | 444 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \ |
mbed_official | 235:685d5f11838f | 445 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) || \ |
mbed_official | 235:685d5f11838f | 446 | ((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE)) |
mbed_official | 235:685d5f11838f | 447 | /** |
mbed_official | 235:685d5f11838f | 448 | * @} |
mbed_official | 235:685d5f11838f | 449 | */ |
mbed_official | 235:685d5f11838f | 450 | |
mbed_official | 235:685d5f11838f | 451 | /** @defgroup ADC_interrupts_definition |
mbed_official | 235:685d5f11838f | 452 | * @{ |
mbed_official | 235:685d5f11838f | 453 | */ |
mbed_official | 235:685d5f11838f | 454 | #define ADC_IT_EOC ((uint32_t)ADC_CR1_EOCIE) |
mbed_official | 235:685d5f11838f | 455 | #define ADC_IT_AWD ((uint32_t)ADC_CR1_AWDIE) |
mbed_official | 235:685d5f11838f | 456 | #define ADC_IT_JEOC ((uint32_t)ADC_CR1_JEOCIE) |
mbed_official | 235:685d5f11838f | 457 | #define ADC_IT_OVR ((uint32_t)ADC_CR1_OVRIE) |
mbed_official | 235:685d5f11838f | 458 | |
mbed_official | 235:685d5f11838f | 459 | #define IS_ADC_IT(IT) (((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_AWD) || \ |
mbed_official | 235:685d5f11838f | 460 | ((IT) == ADC_IT_JEOC)|| ((IT) == ADC_IT_OVR)) |
mbed_official | 235:685d5f11838f | 461 | /** |
mbed_official | 235:685d5f11838f | 462 | * @} |
mbed_official | 235:685d5f11838f | 463 | */ |
mbed_official | 235:685d5f11838f | 464 | |
mbed_official | 235:685d5f11838f | 465 | /** @defgroup ADC_flags_definition |
mbed_official | 235:685d5f11838f | 466 | * @{ |
mbed_official | 235:685d5f11838f | 467 | */ |
mbed_official | 235:685d5f11838f | 468 | #define ADC_FLAG_AWD ((uint32_t)ADC_SR_AWD) |
mbed_official | 235:685d5f11838f | 469 | #define ADC_FLAG_EOC ((uint32_t)ADC_SR_EOC) |
mbed_official | 235:685d5f11838f | 470 | #define ADC_FLAG_JEOC ((uint32_t)ADC_SR_JEOC) |
mbed_official | 235:685d5f11838f | 471 | #define ADC_FLAG_JSTRT ((uint32_t)ADC_SR_JSTRT) |
mbed_official | 235:685d5f11838f | 472 | #define ADC_FLAG_STRT ((uint32_t)ADC_SR_STRT) |
mbed_official | 235:685d5f11838f | 473 | #define ADC_FLAG_OVR ((uint32_t)ADC_SR_OVR) |
mbed_official | 235:685d5f11838f | 474 | /** |
mbed_official | 235:685d5f11838f | 475 | * @} |
mbed_official | 235:685d5f11838f | 476 | */ |
mbed_official | 235:685d5f11838f | 477 | |
mbed_official | 235:685d5f11838f | 478 | /** @defgroup ADC_channels_type |
mbed_official | 235:685d5f11838f | 479 | * @{ |
mbed_official | 235:685d5f11838f | 480 | */ |
mbed_official | 235:685d5f11838f | 481 | #define ALL_CHANNELS ((uint32_t)0x00000001) |
mbed_official | 235:685d5f11838f | 482 | #define REGULAR_CHANNELS ((uint32_t)0x00000002) /*!< reserved for future use */ |
mbed_official | 235:685d5f11838f | 483 | #define INJECTED_CHANNELS ((uint32_t)0x00000003) /*!< reserved for future use */ |
mbed_official | 235:685d5f11838f | 484 | |
mbed_official | 235:685d5f11838f | 485 | #define IS_ADC_CHANNELS_TYPE(CHANNEL_TYPE) (((CHANNEL_TYPE) == ALL_CHANNELS) || \ |
mbed_official | 235:685d5f11838f | 486 | ((CHANNEL_TYPE) == REGULAR_CHANNELS) || \ |
mbed_official | 235:685d5f11838f | 487 | ((CHANNEL_TYPE) == INJECTED_CHANNELS)) |
mbed_official | 235:685d5f11838f | 488 | /** |
mbed_official | 235:685d5f11838f | 489 | * @} |
mbed_official | 235:685d5f11838f | 490 | */ |
mbed_official | 235:685d5f11838f | 491 | |
mbed_official | 235:685d5f11838f | 492 | /** @defgroup ADC_thresholds |
mbed_official | 235:685d5f11838f | 493 | * @{ |
mbed_official | 235:685d5f11838f | 494 | */ |
mbed_official | 235:685d5f11838f | 495 | #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= ((uint32_t)0xFFF)) |
mbed_official | 235:685d5f11838f | 496 | /** |
mbed_official | 235:685d5f11838f | 497 | * @} |
mbed_official | 235:685d5f11838f | 498 | */ |
mbed_official | 235:685d5f11838f | 499 | |
mbed_official | 235:685d5f11838f | 500 | /** @defgroup ADC_regular_length |
mbed_official | 235:685d5f11838f | 501 | * @{ |
mbed_official | 235:685d5f11838f | 502 | */ |
mbed_official | 235:685d5f11838f | 503 | #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16))) |
mbed_official | 235:685d5f11838f | 504 | /** |
mbed_official | 235:685d5f11838f | 505 | * @} |
mbed_official | 235:685d5f11838f | 506 | */ |
mbed_official | 235:685d5f11838f | 507 | |
mbed_official | 235:685d5f11838f | 508 | /** @defgroup ADC_regular_rank |
mbed_official | 235:685d5f11838f | 509 | * @{ |
mbed_official | 235:685d5f11838f | 510 | */ |
mbed_official | 235:685d5f11838f | 511 | #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= ((uint32_t)1)) && ((RANK) <= ((uint32_t)16))) |
mbed_official | 235:685d5f11838f | 512 | /** |
mbed_official | 235:685d5f11838f | 513 | * @} |
mbed_official | 235:685d5f11838f | 514 | */ |
mbed_official | 235:685d5f11838f | 515 | |
mbed_official | 235:685d5f11838f | 516 | /** @defgroup ADC_regular_discontinuous_mode_number |
mbed_official | 235:685d5f11838f | 517 | * @{ |
mbed_official | 235:685d5f11838f | 518 | */ |
mbed_official | 235:685d5f11838f | 519 | #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8))) |
mbed_official | 235:685d5f11838f | 520 | /** |
mbed_official | 235:685d5f11838f | 521 | * @} |
mbed_official | 235:685d5f11838f | 522 | */ |
mbed_official | 235:685d5f11838f | 523 | |
mbed_official | 235:685d5f11838f | 524 | /** @defgroup ADC_range_verification |
mbed_official | 235:685d5f11838f | 525 | * @{ |
mbed_official | 235:685d5f11838f | 526 | */ |
mbed_official | 235:685d5f11838f | 527 | #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \ |
mbed_official | 235:685d5f11838f | 528 | ((((RESOLUTION) == ADC_RESOLUTION12b) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \ |
mbed_official | 235:685d5f11838f | 529 | (((RESOLUTION) == ADC_RESOLUTION10b) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \ |
mbed_official | 235:685d5f11838f | 530 | (((RESOLUTION) == ADC_RESOLUTION8b) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \ |
mbed_official | 235:685d5f11838f | 531 | (((RESOLUTION) == ADC_RESOLUTION6b) && ((ADC_VALUE) <= ((uint32_t)0x003F)))) |
mbed_official | 235:685d5f11838f | 532 | /** |
mbed_official | 235:685d5f11838f | 533 | * @} |
mbed_official | 235:685d5f11838f | 534 | */ |
mbed_official | 235:685d5f11838f | 535 | |
mbed_official | 235:685d5f11838f | 536 | /** |
mbed_official | 235:685d5f11838f | 537 | * @} |
mbed_official | 235:685d5f11838f | 538 | */ |
mbed_official | 235:685d5f11838f | 539 | |
mbed_official | 235:685d5f11838f | 540 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 541 | |
mbed_official | 235:685d5f11838f | 542 | /** @brief Reset ADC handle state |
mbed_official | 235:685d5f11838f | 543 | * @param __HANDLE__: ADC handle |
mbed_official | 235:685d5f11838f | 544 | * @retval None |
mbed_official | 235:685d5f11838f | 545 | */ |
mbed_official | 235:685d5f11838f | 546 | #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET) |
mbed_official | 235:685d5f11838f | 547 | |
mbed_official | 235:685d5f11838f | 548 | /** |
mbed_official | 235:685d5f11838f | 549 | * @brief Enable the ADC peripheral. |
mbed_official | 235:685d5f11838f | 550 | * @param __HANDLE__: ADC handle |
mbed_official | 235:685d5f11838f | 551 | * @retval None |
mbed_official | 235:685d5f11838f | 552 | */ |
mbed_official | 235:685d5f11838f | 553 | #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON) |
mbed_official | 235:685d5f11838f | 554 | |
mbed_official | 235:685d5f11838f | 555 | /** |
mbed_official | 235:685d5f11838f | 556 | * @brief Disable the ADC peripheral. |
mbed_official | 235:685d5f11838f | 557 | * @param __HANDLE__: ADC handle |
mbed_official | 235:685d5f11838f | 558 | * @retval None |
mbed_official | 235:685d5f11838f | 559 | */ |
mbed_official | 235:685d5f11838f | 560 | #define __HAL_ADC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON) |
mbed_official | 235:685d5f11838f | 561 | |
mbed_official | 235:685d5f11838f | 562 | /** |
mbed_official | 235:685d5f11838f | 563 | * @brief Set ADC Regular channel sequence length. |
mbed_official | 235:685d5f11838f | 564 | * @param _NbrOfConversion_: Regular channel sequence length. |
mbed_official | 235:685d5f11838f | 565 | * @retval None |
mbed_official | 235:685d5f11838f | 566 | */ |
mbed_official | 235:685d5f11838f | 567 | #define __HAL_ADC_SQR1(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1) << 20) |
mbed_official | 235:685d5f11838f | 568 | |
mbed_official | 235:685d5f11838f | 569 | /** |
mbed_official | 235:685d5f11838f | 570 | * @brief Set the ADC's sample time for channel numbers between 10 and 18. |
mbed_official | 235:685d5f11838f | 571 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 235:685d5f11838f | 572 | * @param _CHANNELNB_: Channel number. |
mbed_official | 235:685d5f11838f | 573 | * @retval None |
mbed_official | 235:685d5f11838f | 574 | */ |
mbed_official | 235:685d5f11838f | 575 | #define __HAL_ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 10))) |
mbed_official | 235:685d5f11838f | 576 | |
mbed_official | 235:685d5f11838f | 577 | /** |
mbed_official | 235:685d5f11838f | 578 | * @brief Set the ADC's sample time for channel numbers between 0 and 9. |
mbed_official | 235:685d5f11838f | 579 | * @param _SAMPLETIME_: Sample time parameter. |
mbed_official | 235:685d5f11838f | 580 | * @param _CHANNELNB_: Channel number. |
mbed_official | 235:685d5f11838f | 581 | * @retval None |
mbed_official | 235:685d5f11838f | 582 | */ |
mbed_official | 235:685d5f11838f | 583 | #define __HAL_ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (_CHANNELNB_))) |
mbed_official | 235:685d5f11838f | 584 | |
mbed_official | 235:685d5f11838f | 585 | /** |
mbed_official | 235:685d5f11838f | 586 | * @brief Set the selected regular channel rank for rank between 1 and 6. |
mbed_official | 235:685d5f11838f | 587 | * @param _CHANNELNB_: Channel number. |
mbed_official | 235:685d5f11838f | 588 | * @param _RANKNB_: Rank number. |
mbed_official | 235:685d5f11838f | 589 | * @retval None |
mbed_official | 235:685d5f11838f | 590 | */ |
mbed_official | 235:685d5f11838f | 591 | #define __HAL_ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 1))) |
mbed_official | 235:685d5f11838f | 592 | |
mbed_official | 235:685d5f11838f | 593 | /** |
mbed_official | 235:685d5f11838f | 594 | * @brief Set the selected regular channel rank for rank between 7 and 12. |
mbed_official | 235:685d5f11838f | 595 | * @param _CHANNELNB_: Channel number. |
mbed_official | 235:685d5f11838f | 596 | * @param _RANKNB_: Rank number. |
mbed_official | 235:685d5f11838f | 597 | * @retval None |
mbed_official | 235:685d5f11838f | 598 | */ |
mbed_official | 235:685d5f11838f | 599 | #define __HAL_ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 7))) |
mbed_official | 235:685d5f11838f | 600 | |
mbed_official | 235:685d5f11838f | 601 | /** |
mbed_official | 235:685d5f11838f | 602 | * @brief Set the selected regular channel rank for rank between 13 and 16. |
mbed_official | 235:685d5f11838f | 603 | * @param _CHANNELNB_: Channel number. |
mbed_official | 235:685d5f11838f | 604 | * @param _RANKNB_: Rank number. |
mbed_official | 235:685d5f11838f | 605 | * @retval None |
mbed_official | 235:685d5f11838f | 606 | */ |
mbed_official | 235:685d5f11838f | 607 | #define __HAL_ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 13))) |
mbed_official | 235:685d5f11838f | 608 | |
mbed_official | 235:685d5f11838f | 609 | /** |
mbed_official | 235:685d5f11838f | 610 | * @brief Enable ADC continuous conversion mode. |
mbed_official | 235:685d5f11838f | 611 | * @param _CONTINUOUS_MODE_: Continuous mode. |
mbed_official | 235:685d5f11838f | 612 | * @retval None |
mbed_official | 235:685d5f11838f | 613 | */ |
mbed_official | 235:685d5f11838f | 614 | #define __HAL_ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1) |
mbed_official | 235:685d5f11838f | 615 | |
mbed_official | 235:685d5f11838f | 616 | /** |
mbed_official | 235:685d5f11838f | 617 | * @brief Configures the number of discontinuous conversions for the regular group channels. |
mbed_official | 235:685d5f11838f | 618 | * @param _NBR_DISCONTINUOUSCONV_: Number of discontinuous conversions. |
mbed_official | 235:685d5f11838f | 619 | * @retval None |
mbed_official | 235:685d5f11838f | 620 | */ |
mbed_official | 235:685d5f11838f | 621 | #define __HAL_ADC_CR1_DISCONTINUOUS(_NBR_DISCONTINUOUSCONV_) (((_NBR_DISCONTINUOUSCONV_) - 1) << 13) |
mbed_official | 235:685d5f11838f | 622 | |
mbed_official | 235:685d5f11838f | 623 | /** |
mbed_official | 235:685d5f11838f | 624 | * @brief Enable ADC scan mode. |
mbed_official | 235:685d5f11838f | 625 | * @param _SCANCONV_MODE_: Scan conversion mode. |
mbed_official | 235:685d5f11838f | 626 | * @retval None |
mbed_official | 235:685d5f11838f | 627 | */ |
mbed_official | 235:685d5f11838f | 628 | #define __HAL_ADC_CR1_SCANCONV(_SCANCONV_MODE_) ((_SCANCONV_MODE_) << 8) |
mbed_official | 235:685d5f11838f | 629 | |
mbed_official | 235:685d5f11838f | 630 | /** |
mbed_official | 235:685d5f11838f | 631 | * @brief Enable the ADC end of conversion selection. |
mbed_official | 235:685d5f11838f | 632 | * @param _EOCSelection_MODE_: End of conversion selection mode. |
mbed_official | 235:685d5f11838f | 633 | * @retval None |
mbed_official | 235:685d5f11838f | 634 | */ |
mbed_official | 235:685d5f11838f | 635 | #define __HAL_ADC_CR2_EOCSelection(_EOCSelection_MODE_) ((_EOCSelection_MODE_) << 10) |
mbed_official | 235:685d5f11838f | 636 | |
mbed_official | 235:685d5f11838f | 637 | /** |
mbed_official | 235:685d5f11838f | 638 | * @brief Enable the ADC DMA continuous request. |
mbed_official | 235:685d5f11838f | 639 | * @param _DMAContReq_MODE_: DMA continuous request mode. |
mbed_official | 235:685d5f11838f | 640 | * @retval None |
mbed_official | 235:685d5f11838f | 641 | */ |
mbed_official | 235:685d5f11838f | 642 | #define __HAL_ADC_CR2_DMAContReq(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 9) |
mbed_official | 235:685d5f11838f | 643 | |
mbed_official | 235:685d5f11838f | 644 | /** |
mbed_official | 235:685d5f11838f | 645 | * @brief Enable the ADC end of conversion interrupt. |
mbed_official | 235:685d5f11838f | 646 | * @param __HANDLE__: specifies the ADC Handle. |
mbed_official | 235:685d5f11838f | 647 | * @param __INTERRUPT__: ADC Interrupt. |
mbed_official | 235:685d5f11838f | 648 | * @retval None |
mbed_official | 235:685d5f11838f | 649 | */ |
mbed_official | 235:685d5f11838f | 650 | #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 651 | |
mbed_official | 235:685d5f11838f | 652 | /** |
mbed_official | 235:685d5f11838f | 653 | * @brief Disable the ADC end of conversion interrupt. |
mbed_official | 235:685d5f11838f | 654 | * @param __HANDLE__: specifies the ADC Handle. |
mbed_official | 235:685d5f11838f | 655 | * @param __INTERRUPT__: ADC interrupt. |
mbed_official | 235:685d5f11838f | 656 | * @retval None |
mbed_official | 235:685d5f11838f | 657 | */ |
mbed_official | 235:685d5f11838f | 658 | #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 659 | |
mbed_official | 235:685d5f11838f | 660 | /** @brief Check if the specified ADC interrupt source is enabled or disabled. |
mbed_official | 235:685d5f11838f | 661 | * @param __HANDLE__: specifies the ADC Handle. |
mbed_official | 235:685d5f11838f | 662 | * @param __INTERRUPT__: specifies the ADC interrupt source to check. |
mbed_official | 235:685d5f11838f | 663 | * @retval The new state of __IT__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 664 | */ |
mbed_official | 235:685d5f11838f | 665 | #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
mbed_official | 235:685d5f11838f | 666 | |
mbed_official | 235:685d5f11838f | 667 | /** |
mbed_official | 235:685d5f11838f | 668 | * @brief Clear the ADC's pending flags. |
mbed_official | 235:685d5f11838f | 669 | * @param __HANDLE__: specifies the ADC Handle. |
mbed_official | 235:685d5f11838f | 670 | * @param __FLAG__: ADC flag. |
mbed_official | 235:685d5f11838f | 671 | * @retval None |
mbed_official | 235:685d5f11838f | 672 | */ |
mbed_official | 235:685d5f11838f | 673 | #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) |
mbed_official | 235:685d5f11838f | 674 | |
mbed_official | 235:685d5f11838f | 675 | /** |
mbed_official | 235:685d5f11838f | 676 | * @brief Get the selected ADC's flag status. |
mbed_official | 235:685d5f11838f | 677 | * @param __HANDLE__: specifies the ADC Handle. |
mbed_official | 235:685d5f11838f | 678 | * @param __FLAG__: ADC flag. |
mbed_official | 235:685d5f11838f | 679 | * @retval None |
mbed_official | 235:685d5f11838f | 680 | */ |
mbed_official | 235:685d5f11838f | 681 | #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
mbed_official | 235:685d5f11838f | 682 | |
mbed_official | 235:685d5f11838f | 683 | /** |
mbed_official | 235:685d5f11838f | 684 | * @brief Return resolution bits in CR1 register. |
mbed_official | 235:685d5f11838f | 685 | * @param __HANDLE__: ADC handle |
mbed_official | 235:685d5f11838f | 686 | * @retval None |
mbed_official | 235:685d5f11838f | 687 | */ |
mbed_official | 235:685d5f11838f | 688 | #define __HAL_ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CR1) & ADC_CR1_RES) |
mbed_official | 235:685d5f11838f | 689 | |
mbed_official | 235:685d5f11838f | 690 | /* Include ADC HAL Extension module */ |
mbed_official | 235:685d5f11838f | 691 | #include "stm32f4xx_hal_adc_ex.h" |
mbed_official | 235:685d5f11838f | 692 | |
mbed_official | 235:685d5f11838f | 693 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 694 | /* Initialization/de-initialization functions ***********************************/ |
mbed_official | 235:685d5f11838f | 695 | HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 696 | HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc); |
mbed_official | 235:685d5f11838f | 697 | void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 698 | void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 699 | |
mbed_official | 235:685d5f11838f | 700 | /* I/O operation functions ******************************************************/ |
mbed_official | 235:685d5f11838f | 701 | HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 702 | HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 703 | HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 704 | |
mbed_official | 235:685d5f11838f | 705 | HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 706 | |
mbed_official | 235:685d5f11838f | 707 | HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 708 | HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 709 | |
mbed_official | 235:685d5f11838f | 710 | void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 711 | |
mbed_official | 235:685d5f11838f | 712 | HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length); |
mbed_official | 235:685d5f11838f | 713 | HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 714 | |
mbed_official | 235:685d5f11838f | 715 | uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 716 | |
mbed_official | 235:685d5f11838f | 717 | void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 718 | void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 719 | void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 720 | void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc); |
mbed_official | 235:685d5f11838f | 721 | |
mbed_official | 235:685d5f11838f | 722 | /* Peripheral Control functions *************************************************/ |
mbed_official | 235:685d5f11838f | 723 | HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig); |
mbed_official | 235:685d5f11838f | 724 | HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig); |
mbed_official | 235:685d5f11838f | 725 | |
mbed_official | 235:685d5f11838f | 726 | /* Peripheral State functions ***************************************************/ |
mbed_official | 235:685d5f11838f | 727 | HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc); |
mbed_official | 235:685d5f11838f | 728 | uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc); |
mbed_official | 235:685d5f11838f | 729 | |
mbed_official | 235:685d5f11838f | 730 | /** |
mbed_official | 235:685d5f11838f | 731 | * @} |
mbed_official | 235:685d5f11838f | 732 | */ |
mbed_official | 235:685d5f11838f | 733 | |
mbed_official | 235:685d5f11838f | 734 | /** |
mbed_official | 235:685d5f11838f | 735 | * @} |
mbed_official | 235:685d5f11838f | 736 | */ |
mbed_official | 235:685d5f11838f | 737 | |
mbed_official | 235:685d5f11838f | 738 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 739 | } |
mbed_official | 235:685d5f11838f | 740 | #endif |
mbed_official | 235:685d5f11838f | 741 | |
mbed_official | 235:685d5f11838f | 742 | #endif /*__STM32F4xx_ADC_H */ |
mbed_official | 235:685d5f11838f | 743 | |
mbed_official | 235:685d5f11838f | 744 | |
mbed_official | 235:685d5f11838f | 745 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |