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