mbed library sources

Dependents:   bare

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Feb 26 09:45:12 2014 +0000
Revision:
106:ced8cbb51063
Parent:
80:66393a7b209d
Synchronized with git revision 4222735eff5868389433f0e9271976b39c8115cd

Full URL: https://github.com/mbedmicro/mbed/commit/4222735eff5868389433f0e9271976b39c8115cd/

[NUCLEO_xxx] Update STM32CubeF4 driver V1.0.0 + update license

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 76:aeb1df146756 1 /**
mbed_official 76:aeb1df146756 2 ******************************************************************************
mbed_official 76:aeb1df146756 3 * @file stm32l1xx_adc.h
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 80:66393a7b209d 5 * @version V1.3.0
mbed_official 80:66393a7b209d 6 * @date 31-January-2014
mbed_official 76:aeb1df146756 7 * @brief This file contains all the functions prototypes for the ADC firmware
mbed_official 76:aeb1df146756 8 * library.
mbed_official 76:aeb1df146756 9 ******************************************************************************
mbed_official 76:aeb1df146756 10 * @attention
mbed_official 76:aeb1df146756 11 *
mbed_official 106:ced8cbb51063 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 76:aeb1df146756 13 *
mbed_official 106:ced8cbb51063 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 106:ced8cbb51063 15 * are permitted provided that the following conditions are met:
mbed_official 106:ced8cbb51063 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 106:ced8cbb51063 17 * this list of conditions and the following disclaimer.
mbed_official 106:ced8cbb51063 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 106:ced8cbb51063 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 106:ced8cbb51063 20 * and/or other materials provided with the distribution.
mbed_official 106:ced8cbb51063 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 106:ced8cbb51063 22 * may be used to endorse or promote products derived from this software
mbed_official 106:ced8cbb51063 23 * without specific prior written permission.
mbed_official 76:aeb1df146756 24 *
mbed_official 106:ced8cbb51063 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 106:ced8cbb51063 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 106:ced8cbb51063 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 106:ced8cbb51063 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 106:ced8cbb51063 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 106:ced8cbb51063 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 106:ced8cbb51063 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 106:ced8cbb51063 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 106:ced8cbb51063 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 106:ced8cbb51063 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 76:aeb1df146756 35 *
mbed_official 76:aeb1df146756 36 ******************************************************************************
mbed_official 76:aeb1df146756 37 */
mbed_official 76:aeb1df146756 38
mbed_official 76:aeb1df146756 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 76:aeb1df146756 40 #ifndef __STM32L1xx_ADC_H
mbed_official 76:aeb1df146756 41 #define __STM32L1xx_ADC_H
mbed_official 76:aeb1df146756 42
mbed_official 76:aeb1df146756 43 #ifdef __cplusplus
mbed_official 76:aeb1df146756 44 extern "C" {
mbed_official 76:aeb1df146756 45 #endif
mbed_official 76:aeb1df146756 46
mbed_official 76:aeb1df146756 47 /* Includes ------------------------------------------------------------------*/
mbed_official 76:aeb1df146756 48 #include "stm32l1xx.h"
mbed_official 76:aeb1df146756 49
mbed_official 76:aeb1df146756 50 /** @addtogroup STM32L1xx_StdPeriph_Driver
mbed_official 76:aeb1df146756 51 * @{
mbed_official 76:aeb1df146756 52 */
mbed_official 76:aeb1df146756 53
mbed_official 76:aeb1df146756 54 /** @addtogroup ADC
mbed_official 76:aeb1df146756 55 * @{
mbed_official 76:aeb1df146756 56 */
mbed_official 76:aeb1df146756 57
mbed_official 76:aeb1df146756 58 /* Exported types ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 59
mbed_official 76:aeb1df146756 60 /**
mbed_official 76:aeb1df146756 61 * @brief ADC Init structure definition
mbed_official 76:aeb1df146756 62 */
mbed_official 76:aeb1df146756 63
mbed_official 76:aeb1df146756 64 typedef struct
mbed_official 76:aeb1df146756 65 {
mbed_official 76:aeb1df146756 66 uint32_t ADC_Resolution; /*!< Selects the resolution of the conversion.
mbed_official 76:aeb1df146756 67 This parameter can be a value of @ref ADC_Resolution */
mbed_official 76:aeb1df146756 68
mbed_official 76:aeb1df146756 69 FunctionalState ADC_ScanConvMode; /*!< Specifies whether the conversion is performed in
mbed_official 76:aeb1df146756 70 Scan (multichannel) or Single (one channel) mode.
mbed_official 76:aeb1df146756 71 This parameter can be set to ENABLE or DISABLE */
mbed_official 76:aeb1df146756 72
mbed_official 76:aeb1df146756 73 FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed in
mbed_official 76:aeb1df146756 74 Continuous or Single mode.
mbed_official 76:aeb1df146756 75 This parameter can be set to ENABLE or DISABLE. */
mbed_official 76:aeb1df146756 76
mbed_official 76:aeb1df146756 77 uint32_t ADC_ExternalTrigConvEdge; /*!< Selects the external trigger Edge and enables the
mbed_official 76:aeb1df146756 78 trigger of a regular group. This parameter can be a value
mbed_official 76:aeb1df146756 79 of @ref ADC_external_trigger_edge_for_regular_channels_conversion */
mbed_official 76:aeb1df146756 80
mbed_official 76:aeb1df146756 81 uint32_t ADC_ExternalTrigConv; /*!< Defines the external trigger used to start the analog
mbed_official 76:aeb1df146756 82 to digital conversion of regular channels. This parameter
mbed_official 76:aeb1df146756 83 can be a value of @ref ADC_external_trigger_sources_for_regular_channels_conversion */
mbed_official 76:aeb1df146756 84
mbed_official 76:aeb1df146756 85 uint32_t ADC_DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
mbed_official 76:aeb1df146756 86 This parameter can be a value of @ref ADC_data_align */
mbed_official 76:aeb1df146756 87
mbed_official 76:aeb1df146756 88 uint8_t ADC_NbrOfConversion; /*!< Specifies the number of ADC conversions that will be done
mbed_official 76:aeb1df146756 89 using the sequencer for regular channel group.
mbed_official 76:aeb1df146756 90 This parameter must range from 1 to 27. */
mbed_official 76:aeb1df146756 91 }ADC_InitTypeDef;
mbed_official 76:aeb1df146756 92
mbed_official 76:aeb1df146756 93 typedef struct
mbed_official 76:aeb1df146756 94 {
mbed_official 76:aeb1df146756 95 uint32_t ADC_Prescaler; /*!< Selects the ADC prescaler.
mbed_official 76:aeb1df146756 96 This parameter can be a value
mbed_official 76:aeb1df146756 97 of @ref ADC_Prescaler */
mbed_official 76:aeb1df146756 98 }ADC_CommonInitTypeDef;
mbed_official 76:aeb1df146756 99
mbed_official 76:aeb1df146756 100 /* Exported constants --------------------------------------------------------*/
mbed_official 76:aeb1df146756 101
mbed_official 76:aeb1df146756 102 /** @defgroup ADC_Exported_Constants
mbed_official 76:aeb1df146756 103 * @{
mbed_official 76:aeb1df146756 104 */
mbed_official 76:aeb1df146756 105 #define IS_ADC_ALL_PERIPH(PERIPH) ((PERIPH) == ADC1)
mbed_official 76:aeb1df146756 106 #define IS_ADC_DMA_PERIPH(PERIPH) ((PERIPH) == ADC1)
mbed_official 76:aeb1df146756 107
mbed_official 76:aeb1df146756 108 /** @defgroup ADC_Power_down_during_Idle_and_or_Delay_phase
mbed_official 76:aeb1df146756 109 * @{
mbed_official 76:aeb1df146756 110 */
mbed_official 76:aeb1df146756 111 #define ADC_PowerDown_Delay ((uint32_t)0x00010000)
mbed_official 76:aeb1df146756 112 #define ADC_PowerDown_Idle ((uint32_t)0x00020000)
mbed_official 76:aeb1df146756 113 #define ADC_PowerDown_Idle_Delay ((uint32_t)0x00030000)
mbed_official 76:aeb1df146756 114
mbed_official 76:aeb1df146756 115 #define IS_ADC_POWER_DOWN(DWON) (((DWON) == ADC_PowerDown_Delay) || \
mbed_official 76:aeb1df146756 116 ((DWON) == ADC_PowerDown_Idle) || \
mbed_official 76:aeb1df146756 117 ((DWON) == ADC_PowerDown_Idle_Delay))
mbed_official 76:aeb1df146756 118 /**
mbed_official 76:aeb1df146756 119 * @}
mbed_official 76:aeb1df146756 120 */
mbed_official 76:aeb1df146756 121
mbed_official 76:aeb1df146756 122
mbed_official 76:aeb1df146756 123 /** @defgroup ADC_Prescaler
mbed_official 76:aeb1df146756 124 * @{
mbed_official 76:aeb1df146756 125 */
mbed_official 76:aeb1df146756 126 #define ADC_Prescaler_Div1 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 127 #define ADC_Prescaler_Div2 ((uint32_t)0x00010000)
mbed_official 76:aeb1df146756 128 #define ADC_Prescaler_Div4 ((uint32_t)0x00020000)
mbed_official 76:aeb1df146756 129
mbed_official 76:aeb1df146756 130 #define IS_ADC_PRESCALER(PRESCALER) (((PRESCALER) == ADC_Prescaler_Div1) || \
mbed_official 76:aeb1df146756 131 ((PRESCALER) == ADC_Prescaler_Div2) || \
mbed_official 76:aeb1df146756 132 ((PRESCALER) == ADC_Prescaler_Div4))
mbed_official 76:aeb1df146756 133 /**
mbed_official 76:aeb1df146756 134 * @}
mbed_official 76:aeb1df146756 135 */
mbed_official 76:aeb1df146756 136
mbed_official 76:aeb1df146756 137
mbed_official 76:aeb1df146756 138
mbed_official 76:aeb1df146756 139 /** @defgroup ADC_Resolution
mbed_official 76:aeb1df146756 140 * @{
mbed_official 76:aeb1df146756 141 */
mbed_official 76:aeb1df146756 142 #define ADC_Resolution_12b ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 143 #define ADC_Resolution_10b ((uint32_t)0x01000000)
mbed_official 76:aeb1df146756 144 #define ADC_Resolution_8b ((uint32_t)0x02000000)
mbed_official 76:aeb1df146756 145 #define ADC_Resolution_6b ((uint32_t)0x03000000)
mbed_official 76:aeb1df146756 146
mbed_official 76:aeb1df146756 147 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_Resolution_12b) || \
mbed_official 76:aeb1df146756 148 ((RESOLUTION) == ADC_Resolution_10b) || \
mbed_official 76:aeb1df146756 149 ((RESOLUTION) == ADC_Resolution_8b) || \
mbed_official 76:aeb1df146756 150 ((RESOLUTION) == ADC_Resolution_6b))
mbed_official 76:aeb1df146756 151
mbed_official 76:aeb1df146756 152 /**
mbed_official 76:aeb1df146756 153 * @}
mbed_official 76:aeb1df146756 154 */
mbed_official 76:aeb1df146756 155
mbed_official 76:aeb1df146756 156 /** @defgroup ADC_external_trigger_edge_for_regular_channels_conversion
mbed_official 76:aeb1df146756 157 * @{
mbed_official 76:aeb1df146756 158 */
mbed_official 76:aeb1df146756 159 #define ADC_ExternalTrigConvEdge_None ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 160 #define ADC_ExternalTrigConvEdge_Rising ((uint32_t)0x10000000)
mbed_official 76:aeb1df146756 161 #define ADC_ExternalTrigConvEdge_Falling ((uint32_t)0x20000000)
mbed_official 76:aeb1df146756 162 #define ADC_ExternalTrigConvEdge_RisingFalling ((uint32_t)0x30000000)
mbed_official 76:aeb1df146756 163
mbed_official 76:aeb1df146756 164 #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigConvEdge_None) || \
mbed_official 76:aeb1df146756 165 ((EDGE) == ADC_ExternalTrigConvEdge_Rising) || \
mbed_official 76:aeb1df146756 166 ((EDGE) == ADC_ExternalTrigConvEdge_Falling) || \
mbed_official 76:aeb1df146756 167 ((EDGE) == ADC_ExternalTrigConvEdge_RisingFalling))
mbed_official 76:aeb1df146756 168 /**
mbed_official 76:aeb1df146756 169 * @}
mbed_official 76:aeb1df146756 170 */
mbed_official 76:aeb1df146756 171
mbed_official 76:aeb1df146756 172 /** @defgroup ADC_external_trigger_sources_for_regular_channels_conversion
mbed_official 76:aeb1df146756 173 * @{
mbed_official 76:aeb1df146756 174 */
mbed_official 76:aeb1df146756 175
mbed_official 76:aeb1df146756 176 /* TIM2 */
mbed_official 76:aeb1df146756 177 #define ADC_ExternalTrigConv_T2_CC3 ((uint32_t)0x02000000)
mbed_official 76:aeb1df146756 178 #define ADC_ExternalTrigConv_T2_CC2 ((uint32_t)0x03000000)
mbed_official 76:aeb1df146756 179 #define ADC_ExternalTrigConv_T2_TRGO ((uint32_t)0x06000000)
mbed_official 76:aeb1df146756 180
mbed_official 76:aeb1df146756 181 /* TIM3 */
mbed_official 76:aeb1df146756 182 #define ADC_ExternalTrigConv_T3_CC1 ((uint32_t)0x07000000)
mbed_official 76:aeb1df146756 183 #define ADC_ExternalTrigConv_T3_CC3 ((uint32_t)0x08000000)
mbed_official 76:aeb1df146756 184 #define ADC_ExternalTrigConv_T3_TRGO ((uint32_t)0x04000000)
mbed_official 76:aeb1df146756 185
mbed_official 76:aeb1df146756 186 /* TIM4 */
mbed_official 76:aeb1df146756 187 #define ADC_ExternalTrigConv_T4_CC4 ((uint32_t)0x05000000)
mbed_official 76:aeb1df146756 188 #define ADC_ExternalTrigConv_T4_TRGO ((uint32_t)0x09000000)
mbed_official 76:aeb1df146756 189
mbed_official 76:aeb1df146756 190 /* TIM6 */
mbed_official 76:aeb1df146756 191 #define ADC_ExternalTrigConv_T6_TRGO ((uint32_t)0x0A000000)
mbed_official 76:aeb1df146756 192
mbed_official 76:aeb1df146756 193 /* TIM9 */
mbed_official 76:aeb1df146756 194 #define ADC_ExternalTrigConv_T9_CC2 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 195 #define ADC_ExternalTrigConv_T9_TRGO ((uint32_t)0x01000000)
mbed_official 76:aeb1df146756 196
mbed_official 76:aeb1df146756 197 /* EXTI */
mbed_official 76:aeb1df146756 198 #define ADC_ExternalTrigConv_Ext_IT11 ((uint32_t)0x0F000000)
mbed_official 76:aeb1df146756 199
mbed_official 76:aeb1df146756 200 #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_ExternalTrigConv_T9_CC2) || \
mbed_official 76:aeb1df146756 201 ((REGTRIG) == ADC_ExternalTrigConv_T9_TRGO) || \
mbed_official 76:aeb1df146756 202 ((REGTRIG) == ADC_ExternalTrigConv_T2_CC3) || \
mbed_official 76:aeb1df146756 203 ((REGTRIG) == ADC_ExternalTrigConv_T2_CC2) || \
mbed_official 76:aeb1df146756 204 ((REGTRIG) == ADC_ExternalTrigConv_T3_TRGO) || \
mbed_official 76:aeb1df146756 205 ((REGTRIG) == ADC_ExternalTrigConv_T4_CC4) || \
mbed_official 76:aeb1df146756 206 ((REGTRIG) == ADC_ExternalTrigConv_T2_TRGO) || \
mbed_official 76:aeb1df146756 207 ((REGTRIG) == ADC_ExternalTrigConv_T3_CC1) || \
mbed_official 76:aeb1df146756 208 ((REGTRIG) == ADC_ExternalTrigConv_T3_CC3) || \
mbed_official 76:aeb1df146756 209 ((REGTRIG) == ADC_ExternalTrigConv_T4_TRGO) || \
mbed_official 76:aeb1df146756 210 ((REGTRIG) == ADC_ExternalTrigConv_T6_TRGO) || \
mbed_official 76:aeb1df146756 211 ((REGTRIG) == ADC_ExternalTrigConv_Ext_IT11))
mbed_official 76:aeb1df146756 212 /**
mbed_official 76:aeb1df146756 213 * @}
mbed_official 76:aeb1df146756 214 */
mbed_official 76:aeb1df146756 215
mbed_official 76:aeb1df146756 216 /** @defgroup ADC_data_align
mbed_official 76:aeb1df146756 217 * @{
mbed_official 76:aeb1df146756 218 */
mbed_official 76:aeb1df146756 219
mbed_official 76:aeb1df146756 220 #define ADC_DataAlign_Right ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 221 #define ADC_DataAlign_Left ((uint32_t)0x00000800)
mbed_official 76:aeb1df146756 222
mbed_official 76:aeb1df146756 223 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \
mbed_official 76:aeb1df146756 224 ((ALIGN) == ADC_DataAlign_Left))
mbed_official 76:aeb1df146756 225 /**
mbed_official 76:aeb1df146756 226 * @}
mbed_official 76:aeb1df146756 227 */
mbed_official 76:aeb1df146756 228
mbed_official 76:aeb1df146756 229 /** @defgroup ADC_channels
mbed_official 76:aeb1df146756 230 * @{
mbed_official 76:aeb1df146756 231 */
mbed_official 76:aeb1df146756 232 /* ADC Bank A Channels -------------------------------------------------------*/
mbed_official 76:aeb1df146756 233 #define ADC_Channel_0 ((uint8_t)0x00)
mbed_official 76:aeb1df146756 234 #define ADC_Channel_1 ((uint8_t)0x01)
mbed_official 76:aeb1df146756 235 #define ADC_Channel_2 ((uint8_t)0x02)
mbed_official 76:aeb1df146756 236 #define ADC_Channel_3 ((uint8_t)0x03)
mbed_official 76:aeb1df146756 237
mbed_official 76:aeb1df146756 238 #define ADC_Channel_6 ((uint8_t)0x06)
mbed_official 76:aeb1df146756 239 #define ADC_Channel_7 ((uint8_t)0x07)
mbed_official 76:aeb1df146756 240 #define ADC_Channel_8 ((uint8_t)0x08)
mbed_official 76:aeb1df146756 241 #define ADC_Channel_9 ((uint8_t)0x09)
mbed_official 76:aeb1df146756 242 #define ADC_Channel_10 ((uint8_t)0x0A)
mbed_official 76:aeb1df146756 243 #define ADC_Channel_11 ((uint8_t)0x0B)
mbed_official 76:aeb1df146756 244 #define ADC_Channel_12 ((uint8_t)0x0C)
mbed_official 76:aeb1df146756 245
mbed_official 76:aeb1df146756 246
mbed_official 76:aeb1df146756 247 /* ADC Bank B Channels -------------------------------------------------------*/
mbed_official 76:aeb1df146756 248 #define ADC_Channel_0b ADC_Channel_0
mbed_official 76:aeb1df146756 249 #define ADC_Channel_1b ADC_Channel_1
mbed_official 76:aeb1df146756 250 #define ADC_Channel_2b ADC_Channel_2
mbed_official 76:aeb1df146756 251 #define ADC_Channel_3b ADC_Channel_3
mbed_official 76:aeb1df146756 252
mbed_official 76:aeb1df146756 253 #define ADC_Channel_6b ADC_Channel_6
mbed_official 76:aeb1df146756 254 #define ADC_Channel_7b ADC_Channel_7
mbed_official 76:aeb1df146756 255 #define ADC_Channel_8b ADC_Channel_8
mbed_official 76:aeb1df146756 256 #define ADC_Channel_9b ADC_Channel_9
mbed_official 76:aeb1df146756 257 #define ADC_Channel_10b ADC_Channel_10
mbed_official 76:aeb1df146756 258 #define ADC_Channel_11b ADC_Channel_11
mbed_official 76:aeb1df146756 259 #define ADC_Channel_12b ADC_Channel_12
mbed_official 76:aeb1df146756 260
mbed_official 76:aeb1df146756 261 /* ADC Common Channels (ADC Bank A and B) ------------------------------------*/
mbed_official 76:aeb1df146756 262 #define ADC_Channel_4 ((uint8_t)0x04)
mbed_official 76:aeb1df146756 263 #define ADC_Channel_5 ((uint8_t)0x05)
mbed_official 76:aeb1df146756 264
mbed_official 76:aeb1df146756 265 #define ADC_Channel_13 ((uint8_t)0x0D)
mbed_official 76:aeb1df146756 266 #define ADC_Channel_14 ((uint8_t)0x0E)
mbed_official 76:aeb1df146756 267 #define ADC_Channel_15 ((uint8_t)0x0F)
mbed_official 76:aeb1df146756 268 #define ADC_Channel_16 ((uint8_t)0x10)
mbed_official 76:aeb1df146756 269 #define ADC_Channel_17 ((uint8_t)0x11)
mbed_official 76:aeb1df146756 270 #define ADC_Channel_18 ((uint8_t)0x12)
mbed_official 76:aeb1df146756 271 #define ADC_Channel_19 ((uint8_t)0x13)
mbed_official 76:aeb1df146756 272 #define ADC_Channel_20 ((uint8_t)0x14)
mbed_official 76:aeb1df146756 273 #define ADC_Channel_21 ((uint8_t)0x15)
mbed_official 76:aeb1df146756 274 #define ADC_Channel_22 ((uint8_t)0x16)
mbed_official 76:aeb1df146756 275 #define ADC_Channel_23 ((uint8_t)0x17)
mbed_official 76:aeb1df146756 276 #define ADC_Channel_24 ((uint8_t)0x18)
mbed_official 76:aeb1df146756 277 #define ADC_Channel_25 ((uint8_t)0x19)
mbed_official 76:aeb1df146756 278
mbed_official 76:aeb1df146756 279 #define ADC_Channel_27 ((uint8_t)0x1B)
mbed_official 76:aeb1df146756 280 #define ADC_Channel_28 ((uint8_t)0x1C)
mbed_official 76:aeb1df146756 281 #define ADC_Channel_29 ((uint8_t)0x1D)
mbed_official 76:aeb1df146756 282 #define ADC_Channel_30 ((uint8_t)0x1E)
mbed_official 76:aeb1df146756 283 #define ADC_Channel_31 ((uint8_t)0x1F)
mbed_official 76:aeb1df146756 284
mbed_official 76:aeb1df146756 285 #define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16)
mbed_official 76:aeb1df146756 286 #define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17)
mbed_official 76:aeb1df146756 287
mbed_official 76:aeb1df146756 288 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_0) || ((CHANNEL) == ADC_Channel_1) || \
mbed_official 76:aeb1df146756 289 ((CHANNEL) == ADC_Channel_2) || ((CHANNEL) == ADC_Channel_3) || \
mbed_official 76:aeb1df146756 290 ((CHANNEL) == ADC_Channel_4) || ((CHANNEL) == ADC_Channel_5) || \
mbed_official 76:aeb1df146756 291 ((CHANNEL) == ADC_Channel_6) || ((CHANNEL) == ADC_Channel_7) || \
mbed_official 76:aeb1df146756 292 ((CHANNEL) == ADC_Channel_8) || ((CHANNEL) == ADC_Channel_9) || \
mbed_official 76:aeb1df146756 293 ((CHANNEL) == ADC_Channel_10) || ((CHANNEL) == ADC_Channel_11) || \
mbed_official 76:aeb1df146756 294 ((CHANNEL) == ADC_Channel_12) || ((CHANNEL) == ADC_Channel_13) || \
mbed_official 76:aeb1df146756 295 ((CHANNEL) == ADC_Channel_14) || ((CHANNEL) == ADC_Channel_15) || \
mbed_official 76:aeb1df146756 296 ((CHANNEL) == ADC_Channel_16) || ((CHANNEL) == ADC_Channel_17) || \
mbed_official 76:aeb1df146756 297 ((CHANNEL) == ADC_Channel_18) || ((CHANNEL) == ADC_Channel_19) || \
mbed_official 76:aeb1df146756 298 ((CHANNEL) == ADC_Channel_20) || ((CHANNEL) == ADC_Channel_21) || \
mbed_official 76:aeb1df146756 299 ((CHANNEL) == ADC_Channel_22) || ((CHANNEL) == ADC_Channel_23) || \
mbed_official 76:aeb1df146756 300 ((CHANNEL) == ADC_Channel_24) || ((CHANNEL) == ADC_Channel_25) || \
mbed_official 76:aeb1df146756 301 ((CHANNEL) == ADC_Channel_27) || ((CHANNEL) == ADC_Channel_28) || \
mbed_official 76:aeb1df146756 302 ((CHANNEL) == ADC_Channel_29) || ((CHANNEL) == ADC_Channel_30) || \
mbed_official 76:aeb1df146756 303 ((CHANNEL) == ADC_Channel_31))
mbed_official 76:aeb1df146756 304 /**
mbed_official 76:aeb1df146756 305 * @}
mbed_official 76:aeb1df146756 306 */
mbed_official 76:aeb1df146756 307
mbed_official 76:aeb1df146756 308 /** @defgroup ADC_sampling_times
mbed_official 76:aeb1df146756 309 * @{
mbed_official 76:aeb1df146756 310 */
mbed_official 76:aeb1df146756 311
mbed_official 76:aeb1df146756 312 #define ADC_SampleTime_4Cycles ((uint8_t)0x00)
mbed_official 76:aeb1df146756 313 #define ADC_SampleTime_9Cycles ((uint8_t)0x01)
mbed_official 76:aeb1df146756 314 #define ADC_SampleTime_16Cycles ((uint8_t)0x02)
mbed_official 76:aeb1df146756 315 #define ADC_SampleTime_24Cycles ((uint8_t)0x03)
mbed_official 76:aeb1df146756 316 #define ADC_SampleTime_48Cycles ((uint8_t)0x04)
mbed_official 76:aeb1df146756 317 #define ADC_SampleTime_96Cycles ((uint8_t)0x05)
mbed_official 76:aeb1df146756 318 #define ADC_SampleTime_192Cycles ((uint8_t)0x06)
mbed_official 76:aeb1df146756 319 #define ADC_SampleTime_384Cycles ((uint8_t)0x07)
mbed_official 76:aeb1df146756 320
mbed_official 76:aeb1df146756 321 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_4Cycles) || \
mbed_official 76:aeb1df146756 322 ((TIME) == ADC_SampleTime_9Cycles) || \
mbed_official 76:aeb1df146756 323 ((TIME) == ADC_SampleTime_16Cycles) || \
mbed_official 76:aeb1df146756 324 ((TIME) == ADC_SampleTime_24Cycles) || \
mbed_official 76:aeb1df146756 325 ((TIME) == ADC_SampleTime_48Cycles) || \
mbed_official 76:aeb1df146756 326 ((TIME) == ADC_SampleTime_96Cycles) || \
mbed_official 76:aeb1df146756 327 ((TIME) == ADC_SampleTime_192Cycles) || \
mbed_official 76:aeb1df146756 328 ((TIME) == ADC_SampleTime_384Cycles))
mbed_official 76:aeb1df146756 329 /**
mbed_official 76:aeb1df146756 330 * @}
mbed_official 76:aeb1df146756 331 */
mbed_official 76:aeb1df146756 332
mbed_official 76:aeb1df146756 333 /** @defgroup ADC_Delay_length
mbed_official 76:aeb1df146756 334 * @{
mbed_official 76:aeb1df146756 335 */
mbed_official 76:aeb1df146756 336
mbed_official 76:aeb1df146756 337 #define ADC_DelayLength_None ((uint8_t)0x00)
mbed_official 76:aeb1df146756 338 #define ADC_DelayLength_Freeze ((uint8_t)0x10)
mbed_official 76:aeb1df146756 339 #define ADC_DelayLength_7Cycles ((uint8_t)0x20)
mbed_official 76:aeb1df146756 340 #define ADC_DelayLength_15Cycles ((uint8_t)0x30)
mbed_official 76:aeb1df146756 341 #define ADC_DelayLength_31Cycles ((uint8_t)0x40)
mbed_official 76:aeb1df146756 342 #define ADC_DelayLength_63Cycles ((uint8_t)0x50)
mbed_official 76:aeb1df146756 343 #define ADC_DelayLength_127Cycles ((uint8_t)0x60)
mbed_official 76:aeb1df146756 344 #define ADC_DelayLength_255Cycles ((uint8_t)0x70)
mbed_official 76:aeb1df146756 345
mbed_official 76:aeb1df146756 346 #define IS_ADC_DELAY_LENGTH(LENGTH) (((LENGTH) == ADC_DelayLength_None) || \
mbed_official 76:aeb1df146756 347 ((LENGTH) == ADC_DelayLength_Freeze) || \
mbed_official 76:aeb1df146756 348 ((LENGTH) == ADC_DelayLength_7Cycles) || \
mbed_official 76:aeb1df146756 349 ((LENGTH) == ADC_DelayLength_15Cycles) || \
mbed_official 76:aeb1df146756 350 ((LENGTH) == ADC_DelayLength_31Cycles) || \
mbed_official 76:aeb1df146756 351 ((LENGTH) == ADC_DelayLength_63Cycles) || \
mbed_official 76:aeb1df146756 352 ((LENGTH) == ADC_DelayLength_127Cycles) || \
mbed_official 76:aeb1df146756 353 ((LENGTH) == ADC_DelayLength_255Cycles))
mbed_official 76:aeb1df146756 354
mbed_official 76:aeb1df146756 355 /**
mbed_official 76:aeb1df146756 356 * @}
mbed_official 76:aeb1df146756 357 */
mbed_official 76:aeb1df146756 358
mbed_official 76:aeb1df146756 359 /** @defgroup ADC_external_trigger_edge_for_injected_channels_conversion
mbed_official 76:aeb1df146756 360 * @{
mbed_official 76:aeb1df146756 361 */
mbed_official 76:aeb1df146756 362 #define ADC_ExternalTrigInjecConvEdge_None ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 363 #define ADC_ExternalTrigInjecConvEdge_Rising ((uint32_t)0x00100000)
mbed_official 76:aeb1df146756 364 #define ADC_ExternalTrigInjecConvEdge_Falling ((uint32_t)0x00200000)
mbed_official 76:aeb1df146756 365 #define ADC_ExternalTrigInjecConvEdge_RisingFalling ((uint32_t)0x00300000)
mbed_official 76:aeb1df146756 366
mbed_official 76:aeb1df146756 367 #define IS_ADC_EXT_INJEC_TRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigInjecConvEdge_None) || \
mbed_official 76:aeb1df146756 368 ((EDGE) == ADC_ExternalTrigInjecConvEdge_Rising) || \
mbed_official 76:aeb1df146756 369 ((EDGE) == ADC_ExternalTrigInjecConvEdge_Falling) || \
mbed_official 76:aeb1df146756 370 ((EDGE) == ADC_ExternalTrigInjecConvEdge_RisingFalling))
mbed_official 76:aeb1df146756 371 /**
mbed_official 76:aeb1df146756 372 * @}
mbed_official 76:aeb1df146756 373 */
mbed_official 76:aeb1df146756 374
mbed_official 76:aeb1df146756 375
mbed_official 76:aeb1df146756 376 /** @defgroup ADC_external_trigger_sources_for_injected_channels_conversion
mbed_official 76:aeb1df146756 377 * @{
mbed_official 76:aeb1df146756 378 */
mbed_official 76:aeb1df146756 379
mbed_official 76:aeb1df146756 380
mbed_official 76:aeb1df146756 381 /* TIM2 */
mbed_official 76:aeb1df146756 382 #define ADC_ExternalTrigInjecConv_T2_TRGO ((uint32_t)0x00020000)
mbed_official 76:aeb1df146756 383 #define ADC_ExternalTrigInjecConv_T2_CC1 ((uint32_t)0x00030000)
mbed_official 76:aeb1df146756 384
mbed_official 76:aeb1df146756 385 /* TIM3 */
mbed_official 76:aeb1df146756 386 #define ADC_ExternalTrigInjecConv_T3_CC4 ((uint32_t)0x00040000)
mbed_official 76:aeb1df146756 387
mbed_official 76:aeb1df146756 388 /* TIM4 */
mbed_official 76:aeb1df146756 389 #define ADC_ExternalTrigInjecConv_T4_TRGO ((uint32_t)0x00050000)
mbed_official 76:aeb1df146756 390 #define ADC_ExternalTrigInjecConv_T4_CC1 ((uint32_t)0x00060000)
mbed_official 76:aeb1df146756 391 #define ADC_ExternalTrigInjecConv_T4_CC2 ((uint32_t)0x00070000)
mbed_official 76:aeb1df146756 392 #define ADC_ExternalTrigInjecConv_T4_CC3 ((uint32_t)0x00080000)
mbed_official 76:aeb1df146756 393
mbed_official 76:aeb1df146756 394 /* TIM7 */
mbed_official 76:aeb1df146756 395 #define ADC_ExternalTrigInjecConv_T7_TRGO ((uint32_t)0x000A0000)
mbed_official 76:aeb1df146756 396
mbed_official 76:aeb1df146756 397 /* TIM9 */
mbed_official 76:aeb1df146756 398 #define ADC_ExternalTrigInjecConv_T9_CC1 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 399 #define ADC_ExternalTrigInjecConv_T9_TRGO ((uint32_t)0x00010000)
mbed_official 76:aeb1df146756 400
mbed_official 76:aeb1df146756 401 /* TIM10 */
mbed_official 76:aeb1df146756 402 #define ADC_ExternalTrigInjecConv_T10_CC1 ((uint32_t)0x00090000)
mbed_official 76:aeb1df146756 403
mbed_official 76:aeb1df146756 404 /* EXTI */
mbed_official 76:aeb1df146756 405 #define ADC_ExternalTrigInjecConv_Ext_IT15 ((uint32_t)0x000F0000)
mbed_official 76:aeb1df146756 406
mbed_official 76:aeb1df146756 407 #define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_ExternalTrigInjecConv_T9_CC1) || \
mbed_official 76:aeb1df146756 408 ((INJTRIG) == ADC_ExternalTrigInjecConv_T9_TRGO) || \
mbed_official 76:aeb1df146756 409 ((INJTRIG) == ADC_ExternalTrigInjecConv_T2_TRGO) || \
mbed_official 76:aeb1df146756 410 ((INJTRIG) == ADC_ExternalTrigInjecConv_T2_CC1) || \
mbed_official 76:aeb1df146756 411 ((INJTRIG) == ADC_ExternalTrigInjecConv_T3_CC4) || \
mbed_official 76:aeb1df146756 412 ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_TRGO) || \
mbed_official 76:aeb1df146756 413 ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC1) || \
mbed_official 76:aeb1df146756 414 ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC2) || \
mbed_official 76:aeb1df146756 415 ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC3) || \
mbed_official 76:aeb1df146756 416 ((INJTRIG) == ADC_ExternalTrigInjecConv_T10_CC1) || \
mbed_official 76:aeb1df146756 417 ((INJTRIG) == ADC_ExternalTrigInjecConv_T7_TRGO) || \
mbed_official 76:aeb1df146756 418 ((INJTRIG) == ADC_ExternalTrigInjecConv_Ext_IT15))
mbed_official 76:aeb1df146756 419 /**
mbed_official 76:aeb1df146756 420 * @}
mbed_official 76:aeb1df146756 421 */
mbed_official 76:aeb1df146756 422
mbed_official 76:aeb1df146756 423 /** @defgroup ADC_injected_channel_selection
mbed_official 76:aeb1df146756 424 * @{
mbed_official 76:aeb1df146756 425 */
mbed_official 76:aeb1df146756 426 #define ADC_InjectedChannel_1 ((uint8_t)0x18)
mbed_official 76:aeb1df146756 427 #define ADC_InjectedChannel_2 ((uint8_t)0x1C)
mbed_official 76:aeb1df146756 428 #define ADC_InjectedChannel_3 ((uint8_t)0x20)
mbed_official 76:aeb1df146756 429 #define ADC_InjectedChannel_4 ((uint8_t)0x24)
mbed_official 76:aeb1df146756 430
mbed_official 76:aeb1df146756 431 #define IS_ADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) == ADC_InjectedChannel_1) || \
mbed_official 76:aeb1df146756 432 ((CHANNEL) == ADC_InjectedChannel_2) || \
mbed_official 76:aeb1df146756 433 ((CHANNEL) == ADC_InjectedChannel_3) || \
mbed_official 76:aeb1df146756 434 ((CHANNEL) == ADC_InjectedChannel_4))
mbed_official 76:aeb1df146756 435 /**
mbed_official 76:aeb1df146756 436 * @}
mbed_official 76:aeb1df146756 437 */
mbed_official 76:aeb1df146756 438
mbed_official 76:aeb1df146756 439 /** @defgroup ADC_analog_watchdog_selection
mbed_official 76:aeb1df146756 440 * @{
mbed_official 76:aeb1df146756 441 */
mbed_official 76:aeb1df146756 442
mbed_official 76:aeb1df146756 443 #define ADC_AnalogWatchdog_SingleRegEnable ((uint32_t)0x00800200)
mbed_official 76:aeb1df146756 444 #define ADC_AnalogWatchdog_SingleInjecEnable ((uint32_t)0x00400200)
mbed_official 76:aeb1df146756 445 #define ADC_AnalogWatchdog_SingleRegOrInjecEnable ((uint32_t)0x00C00200)
mbed_official 76:aeb1df146756 446 #define ADC_AnalogWatchdog_AllRegEnable ((uint32_t)0x00800000)
mbed_official 76:aeb1df146756 447 #define ADC_AnalogWatchdog_AllInjecEnable ((uint32_t)0x00400000)
mbed_official 76:aeb1df146756 448 #define ADC_AnalogWatchdog_AllRegAllInjecEnable ((uint32_t)0x00C00000)
mbed_official 76:aeb1df146756 449 #define ADC_AnalogWatchdog_None ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 450
mbed_official 76:aeb1df146756 451 #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_AnalogWatchdog_SingleRegEnable) || \
mbed_official 76:aeb1df146756 452 ((WATCHDOG) == ADC_AnalogWatchdog_SingleInjecEnable) || \
mbed_official 76:aeb1df146756 453 ((WATCHDOG) == ADC_AnalogWatchdog_SingleRegOrInjecEnable) || \
mbed_official 76:aeb1df146756 454 ((WATCHDOG) == ADC_AnalogWatchdog_AllRegEnable) || \
mbed_official 76:aeb1df146756 455 ((WATCHDOG) == ADC_AnalogWatchdog_AllInjecEnable) || \
mbed_official 76:aeb1df146756 456 ((WATCHDOG) == ADC_AnalogWatchdog_AllRegAllInjecEnable) || \
mbed_official 76:aeb1df146756 457 ((WATCHDOG) == ADC_AnalogWatchdog_None))
mbed_official 76:aeb1df146756 458 /**
mbed_official 76:aeb1df146756 459 * @}
mbed_official 76:aeb1df146756 460 */
mbed_official 76:aeb1df146756 461
mbed_official 76:aeb1df146756 462 /** @defgroup ADC_interrupts_definition
mbed_official 76:aeb1df146756 463 * @{
mbed_official 76:aeb1df146756 464 */
mbed_official 76:aeb1df146756 465
mbed_official 76:aeb1df146756 466 #define ADC_IT_AWD ((uint16_t)0x0106)
mbed_official 76:aeb1df146756 467 #define ADC_IT_EOC ((uint16_t)0x0205)
mbed_official 76:aeb1df146756 468 #define ADC_IT_JEOC ((uint16_t)0x0407)
mbed_official 76:aeb1df146756 469 #define ADC_IT_OVR ((uint16_t)0x201A)
mbed_official 76:aeb1df146756 470
mbed_official 76:aeb1df146756 471 #define IS_ADC_IT(IT) (((IT) == ADC_IT_AWD) || ((IT) == ADC_IT_EOC) || \
mbed_official 76:aeb1df146756 472 ((IT) == ADC_IT_JEOC)|| ((IT) == ADC_IT_OVR))
mbed_official 76:aeb1df146756 473 /**
mbed_official 76:aeb1df146756 474 * @}
mbed_official 76:aeb1df146756 475 */
mbed_official 76:aeb1df146756 476
mbed_official 76:aeb1df146756 477 /** @defgroup ADC_flags_definition
mbed_official 76:aeb1df146756 478 * @{
mbed_official 76:aeb1df146756 479 */
mbed_official 76:aeb1df146756 480
mbed_official 76:aeb1df146756 481 #define ADC_FLAG_AWD ((uint16_t)0x0001)
mbed_official 76:aeb1df146756 482 #define ADC_FLAG_EOC ((uint16_t)0x0002)
mbed_official 76:aeb1df146756 483 #define ADC_FLAG_JEOC ((uint16_t)0x0004)
mbed_official 76:aeb1df146756 484 #define ADC_FLAG_JSTRT ((uint16_t)0x0008)
mbed_official 76:aeb1df146756 485 #define ADC_FLAG_STRT ((uint16_t)0x0010)
mbed_official 76:aeb1df146756 486 #define ADC_FLAG_OVR ((uint16_t)0x0020)
mbed_official 76:aeb1df146756 487 #define ADC_FLAG_ADONS ((uint16_t)0x0040)
mbed_official 76:aeb1df146756 488 #define ADC_FLAG_RCNR ((uint16_t)0x0100)
mbed_official 76:aeb1df146756 489 #define ADC_FLAG_JCNR ((uint16_t)0x0200)
mbed_official 76:aeb1df146756 490
mbed_official 76:aeb1df146756 491 #define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFC0) == 0x00) && ((FLAG) != 0x00))
mbed_official 76:aeb1df146756 492
mbed_official 76:aeb1df146756 493 #define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || ((FLAG) == ADC_FLAG_EOC) || \
mbed_official 76:aeb1df146756 494 ((FLAG) == ADC_FLAG_JEOC) || ((FLAG)== ADC_FLAG_JSTRT) || \
mbed_official 76:aeb1df146756 495 ((FLAG) == ADC_FLAG_STRT) || ((FLAG)== ADC_FLAG_OVR) || \
mbed_official 76:aeb1df146756 496 ((FLAG) == ADC_FLAG_ADONS) || ((FLAG)== ADC_FLAG_RCNR) || \
mbed_official 76:aeb1df146756 497 ((FLAG) == ADC_FLAG_JCNR))
mbed_official 76:aeb1df146756 498 /**
mbed_official 76:aeb1df146756 499 * @}
mbed_official 76:aeb1df146756 500 */
mbed_official 76:aeb1df146756 501
mbed_official 76:aeb1df146756 502 /** @defgroup ADC_thresholds
mbed_official 76:aeb1df146756 503 * @{
mbed_official 76:aeb1df146756 504 */
mbed_official 76:aeb1df146756 505
mbed_official 76:aeb1df146756 506 #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF)
mbed_official 76:aeb1df146756 507
mbed_official 76:aeb1df146756 508 /**
mbed_official 76:aeb1df146756 509 * @}
mbed_official 76:aeb1df146756 510 */
mbed_official 76:aeb1df146756 511
mbed_official 76:aeb1df146756 512 /** @defgroup ADC_injected_offset
mbed_official 76:aeb1df146756 513 * @{
mbed_official 76:aeb1df146756 514 */
mbed_official 76:aeb1df146756 515
mbed_official 76:aeb1df146756 516 #define IS_ADC_OFFSET(OFFSET) ((OFFSET) <= 0xFFF)
mbed_official 76:aeb1df146756 517
mbed_official 76:aeb1df146756 518 /**
mbed_official 76:aeb1df146756 519 * @}
mbed_official 76:aeb1df146756 520 */
mbed_official 76:aeb1df146756 521
mbed_official 76:aeb1df146756 522 /** @defgroup ADC_injected_length
mbed_official 76:aeb1df146756 523 * @{
mbed_official 76:aeb1df146756 524 */
mbed_official 76:aeb1df146756 525
mbed_official 76:aeb1df146756 526 #define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4))
mbed_official 76:aeb1df146756 527
mbed_official 76:aeb1df146756 528 /**
mbed_official 76:aeb1df146756 529 * @}
mbed_official 76:aeb1df146756 530 */
mbed_official 76:aeb1df146756 531
mbed_official 76:aeb1df146756 532 /** @defgroup ADC_injected_rank
mbed_official 76:aeb1df146756 533 * @{
mbed_official 76:aeb1df146756 534 */
mbed_official 76:aeb1df146756 535
mbed_official 76:aeb1df146756 536 #define IS_ADC_INJECTED_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 0x4))
mbed_official 76:aeb1df146756 537
mbed_official 76:aeb1df146756 538 /**
mbed_official 76:aeb1df146756 539 * @}
mbed_official 76:aeb1df146756 540 */
mbed_official 76:aeb1df146756 541
mbed_official 76:aeb1df146756 542 /** @defgroup ADC_regular_length
mbed_official 76:aeb1df146756 543 * @{
mbed_official 76:aeb1df146756 544 */
mbed_official 76:aeb1df146756 545
mbed_official 76:aeb1df146756 546 #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 1) && ((LENGTH) <= 28))
mbed_official 76:aeb1df146756 547
mbed_official 76:aeb1df146756 548 /**
mbed_official 76:aeb1df146756 549 * @}
mbed_official 76:aeb1df146756 550 */
mbed_official 76:aeb1df146756 551
mbed_official 76:aeb1df146756 552 /** @defgroup ADC_regular_rank
mbed_official 76:aeb1df146756 553 * @{
mbed_official 76:aeb1df146756 554 */
mbed_official 76:aeb1df146756 555
mbed_official 76:aeb1df146756 556 #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= 1) && ((RANK) <= 28))
mbed_official 76:aeb1df146756 557
mbed_official 76:aeb1df146756 558 /**
mbed_official 76:aeb1df146756 559 * @}
mbed_official 76:aeb1df146756 560 */
mbed_official 76:aeb1df146756 561
mbed_official 76:aeb1df146756 562 /** @defgroup ADC_regular_discontinuous_mode_number
mbed_official 76:aeb1df146756 563 * @{
mbed_official 76:aeb1df146756 564 */
mbed_official 76:aeb1df146756 565
mbed_official 76:aeb1df146756 566 #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8))
mbed_official 76:aeb1df146756 567
mbed_official 76:aeb1df146756 568 /**
mbed_official 76:aeb1df146756 569 * @}
mbed_official 76:aeb1df146756 570 */
mbed_official 76:aeb1df146756 571
mbed_official 76:aeb1df146756 572 /** @defgroup ADC_Bank_Selection
mbed_official 76:aeb1df146756 573 * @{
mbed_official 76:aeb1df146756 574 */
mbed_official 76:aeb1df146756 575 #define ADC_Bank_A ((uint8_t)0x00)
mbed_official 76:aeb1df146756 576 #define ADC_Bank_B ((uint8_t)0x01)
mbed_official 76:aeb1df146756 577 #define IS_ADC_BANK(BANK) (((BANK) == ADC_Bank_A) || ((BANK) == ADC_Bank_B))
mbed_official 76:aeb1df146756 578
mbed_official 76:aeb1df146756 579 /**
mbed_official 76:aeb1df146756 580 * @}
mbed_official 76:aeb1df146756 581 */
mbed_official 76:aeb1df146756 582
mbed_official 76:aeb1df146756 583 /**
mbed_official 76:aeb1df146756 584 * @}
mbed_official 76:aeb1df146756 585 */
mbed_official 76:aeb1df146756 586
mbed_official 76:aeb1df146756 587 /* Exported macro ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 588 /* Exported functions ------------------------------------------------------- */
mbed_official 76:aeb1df146756 589
mbed_official 76:aeb1df146756 590 /* Function used to set the ADC configuration to the default reset state *****/
mbed_official 76:aeb1df146756 591 void ADC_DeInit(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 592
mbed_official 76:aeb1df146756 593 /* Initialization and Configuration functions *********************************/
mbed_official 76:aeb1df146756 594 void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
mbed_official 76:aeb1df146756 595 void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
mbed_official 76:aeb1df146756 596 void ADC_CommonInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct);
mbed_official 76:aeb1df146756 597 void ADC_CommonStructInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct);
mbed_official 76:aeb1df146756 598 void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 599 void ADC_BankSelection(ADC_TypeDef* ADCx, uint8_t ADC_Bank);
mbed_official 76:aeb1df146756 600
mbed_official 76:aeb1df146756 601 /* Power saving functions *****************************************************/
mbed_official 76:aeb1df146756 602 void ADC_PowerDownCmd(ADC_TypeDef* ADCx, uint32_t ADC_PowerDown, FunctionalState NewState);
mbed_official 76:aeb1df146756 603 void ADC_DelaySelectionConfig(ADC_TypeDef* ADCx, uint8_t ADC_DelayLength);
mbed_official 76:aeb1df146756 604
mbed_official 76:aeb1df146756 605 /* Analog Watchdog configuration functions ************************************/
mbed_official 76:aeb1df146756 606 void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog);
mbed_official 76:aeb1df146756 607 void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold,uint16_t LowThreshold);
mbed_official 76:aeb1df146756 608 void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel);
mbed_official 76:aeb1df146756 609
mbed_official 76:aeb1df146756 610 /* Temperature Sensor & Vrefint (Voltage Reference internal) management function */
mbed_official 76:aeb1df146756 611 void ADC_TempSensorVrefintCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 612
mbed_official 76:aeb1df146756 613 /* Regular Channels Configuration functions ***********************************/
mbed_official 76:aeb1df146756 614 void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
mbed_official 76:aeb1df146756 615 void ADC_SoftwareStartConv(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 616 FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 617 void ADC_EOCOnEachRegularChannelCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 618 void ADC_ContinuousModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 619 void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, uint8_t Number);
mbed_official 76:aeb1df146756 620 void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 621 uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 622
mbed_official 76:aeb1df146756 623 /* Regular Channels DMA Configuration functions *******************************/
mbed_official 76:aeb1df146756 624 void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 625 void ADC_DMARequestAfterLastTransferCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 626
mbed_official 76:aeb1df146756 627 /* Injected channels Configuration functions **********************************/
mbed_official 76:aeb1df146756 628 void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
mbed_official 76:aeb1df146756 629 void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length);
mbed_official 76:aeb1df146756 630 void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset);
mbed_official 76:aeb1df146756 631 void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConv);
mbed_official 76:aeb1df146756 632 void ADC_ExternalTrigInjectedConvEdgeConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConvEdge);
mbed_official 76:aeb1df146756 633 void ADC_SoftwareStartInjectedConv(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 634 FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx);
mbed_official 76:aeb1df146756 635 void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 636 void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
mbed_official 76:aeb1df146756 637 uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel);
mbed_official 76:aeb1df146756 638
mbed_official 76:aeb1df146756 639 /* Interrupts and flags management functions **********************************/
mbed_official 76:aeb1df146756 640 void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState);
mbed_official 76:aeb1df146756 641 FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint16_t ADC_FLAG);
mbed_official 76:aeb1df146756 642 void ADC_ClearFlag(ADC_TypeDef* ADCx, uint16_t ADC_FLAG);
mbed_official 76:aeb1df146756 643 ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint16_t ADC_IT);
mbed_official 76:aeb1df146756 644 void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint16_t ADC_IT);
mbed_official 76:aeb1df146756 645
mbed_official 76:aeb1df146756 646 #ifdef __cplusplus
mbed_official 76:aeb1df146756 647 }
mbed_official 76:aeb1df146756 648 #endif
mbed_official 76:aeb1df146756 649
mbed_official 76:aeb1df146756 650 #endif /*__STM32L1xx_ADC_H */
mbed_official 76:aeb1df146756 651
mbed_official 76:aeb1df146756 652 /**
mbed_official 76:aeb1df146756 653 * @}
mbed_official 76:aeb1df146756 654 */
mbed_official 76:aeb1df146756 655
mbed_official 76:aeb1df146756 656 /**
mbed_official 76:aeb1df146756 657 * @}
mbed_official 76:aeb1df146756 658 */
mbed_official 76:aeb1df146756 659
mbed_official 76:aeb1df146756 660 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/