mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/stm32f0xx_adc.h@76:aeb1df146756, 2014-01-27 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 27 14:30:07 2014 +0000
- Revision:
- 76:aeb1df146756
- Child:
- 106:ced8cbb51063
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd
Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/
Add NUCLEO_L152RE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 76:aeb1df146756 | 1 | /** |
mbed_official | 76:aeb1df146756 | 2 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 3 | * @file stm32f0xx_adc.h |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.3.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 16-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 | 76:aeb1df146756 | 12 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 13 | * |
mbed_official | 76:aeb1df146756 | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
mbed_official | 76:aeb1df146756 | 15 | * You may not use this file except in compliance with the License. |
mbed_official | 76:aeb1df146756 | 16 | * You may obtain a copy of the License at: |
mbed_official | 76:aeb1df146756 | 17 | * |
mbed_official | 76:aeb1df146756 | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
mbed_official | 76:aeb1df146756 | 19 | * |
mbed_official | 76:aeb1df146756 | 20 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 76:aeb1df146756 | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 76:aeb1df146756 | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 76:aeb1df146756 | 23 | * See the License for the specific language governing permissions and |
mbed_official | 76:aeb1df146756 | 24 | * limitations under the License. |
mbed_official | 76:aeb1df146756 | 25 | * |
mbed_official | 76:aeb1df146756 | 26 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 27 | */ |
mbed_official | 76:aeb1df146756 | 28 | |
mbed_official | 76:aeb1df146756 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 30 | #ifndef __STM32F0XX_ADC_H |
mbed_official | 76:aeb1df146756 | 31 | #define __STM32F0XX_ADC_H |
mbed_official | 76:aeb1df146756 | 32 | |
mbed_official | 76:aeb1df146756 | 33 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 34 | extern "C" { |
mbed_official | 76:aeb1df146756 | 35 | #endif |
mbed_official | 76:aeb1df146756 | 36 | |
mbed_official | 76:aeb1df146756 | 37 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 38 | #include "stm32f0xx.h" |
mbed_official | 76:aeb1df146756 | 39 | |
mbed_official | 76:aeb1df146756 | 40 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 41 | * @{ |
mbed_official | 76:aeb1df146756 | 42 | */ |
mbed_official | 76:aeb1df146756 | 43 | |
mbed_official | 76:aeb1df146756 | 44 | /** @addtogroup ADC |
mbed_official | 76:aeb1df146756 | 45 | * @{ |
mbed_official | 76:aeb1df146756 | 46 | */ |
mbed_official | 76:aeb1df146756 | 47 | |
mbed_official | 76:aeb1df146756 | 48 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 49 | |
mbed_official | 76:aeb1df146756 | 50 | /** |
mbed_official | 76:aeb1df146756 | 51 | * @brief ADC Init structure definition |
mbed_official | 76:aeb1df146756 | 52 | */ |
mbed_official | 76:aeb1df146756 | 53 | |
mbed_official | 76:aeb1df146756 | 54 | typedef struct |
mbed_official | 76:aeb1df146756 | 55 | { |
mbed_official | 76:aeb1df146756 | 56 | uint32_t ADC_Resolution; /*!< Selects the resolution of the conversion. |
mbed_official | 76:aeb1df146756 | 57 | This parameter can be a value of @ref ADC_Resolution */ |
mbed_official | 76:aeb1df146756 | 58 | |
mbed_official | 76:aeb1df146756 | 59 | FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed in |
mbed_official | 76:aeb1df146756 | 60 | Continuous or Single mode. |
mbed_official | 76:aeb1df146756 | 61 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 76:aeb1df146756 | 62 | |
mbed_official | 76:aeb1df146756 | 63 | uint32_t ADC_ExternalTrigConvEdge; /*!< Selects the external trigger Edge and enables the |
mbed_official | 76:aeb1df146756 | 64 | trigger of a regular group. This parameter can be a value |
mbed_official | 76:aeb1df146756 | 65 | of @ref ADC_external_trigger_edge_conversion */ |
mbed_official | 76:aeb1df146756 | 66 | |
mbed_official | 76:aeb1df146756 | 67 | uint32_t ADC_ExternalTrigConv; /*!< Defines the external trigger used to start the analog |
mbed_official | 76:aeb1df146756 | 68 | to digital conversion of regular channels. This parameter |
mbed_official | 76:aeb1df146756 | 69 | can be a value of @ref ADC_external_trigger_sources_for_channels_conversion */ |
mbed_official | 76:aeb1df146756 | 70 | |
mbed_official | 76:aeb1df146756 | 71 | uint32_t ADC_DataAlign; /*!< Specifies whether the ADC data alignment is left or right. |
mbed_official | 76:aeb1df146756 | 72 | This parameter can be a value of @ref ADC_data_align */ |
mbed_official | 76:aeb1df146756 | 73 | |
mbed_official | 76:aeb1df146756 | 74 | uint32_t ADC_ScanDirection; /*!< Specifies in which direction the channels will be scanned |
mbed_official | 76:aeb1df146756 | 75 | in the sequence. |
mbed_official | 76:aeb1df146756 | 76 | This parameter can be a value of @ref ADC_Scan_Direction */ |
mbed_official | 76:aeb1df146756 | 77 | }ADC_InitTypeDef; |
mbed_official | 76:aeb1df146756 | 78 | |
mbed_official | 76:aeb1df146756 | 79 | |
mbed_official | 76:aeb1df146756 | 80 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 81 | |
mbed_official | 76:aeb1df146756 | 82 | /** @defgroup ADC_Exported_Constants |
mbed_official | 76:aeb1df146756 | 83 | * @{ |
mbed_official | 76:aeb1df146756 | 84 | */ |
mbed_official | 76:aeb1df146756 | 85 | #define IS_ADC_ALL_PERIPH(PERIPH) ((PERIPH) == ADC1) |
mbed_official | 76:aeb1df146756 | 86 | |
mbed_official | 76:aeb1df146756 | 87 | /** @defgroup ADC_JitterOff |
mbed_official | 76:aeb1df146756 | 88 | * @{ |
mbed_official | 76:aeb1df146756 | 89 | */ |
mbed_official | 76:aeb1df146756 | 90 | /* These defines are obsolete and maintained for legacy purpose only. They are replaced by the ADC_ClockMode */ |
mbed_official | 76:aeb1df146756 | 91 | #define ADC_JitterOff_PCLKDiv2 ADC_CFGR2_JITOFFDIV2 |
mbed_official | 76:aeb1df146756 | 92 | #define ADC_JitterOff_PCLKDiv4 ADC_CFGR2_JITOFFDIV4 |
mbed_official | 76:aeb1df146756 | 93 | |
mbed_official | 76:aeb1df146756 | 94 | #define IS_ADC_JITTEROFF(JITTEROFF) (((JITTEROFF) & 0x3FFFFFFF) == (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 95 | |
mbed_official | 76:aeb1df146756 | 96 | /** |
mbed_official | 76:aeb1df146756 | 97 | * @} |
mbed_official | 76:aeb1df146756 | 98 | */ |
mbed_official | 76:aeb1df146756 | 99 | |
mbed_official | 76:aeb1df146756 | 100 | /** @defgroup ADC_ClockMode |
mbed_official | 76:aeb1df146756 | 101 | * @{ |
mbed_official | 76:aeb1df146756 | 102 | */ |
mbed_official | 76:aeb1df146756 | 103 | #define ADC_ClockMode_AsynClk ((uint32_t)0x00000000) /*!< ADC Asynchronous clock mode */ |
mbed_official | 76:aeb1df146756 | 104 | #define ADC_ClockMode_SynClkDiv2 ADC_CFGR2_CKMODE_0 /*!< Synchronous clock mode divided by 2 */ |
mbed_official | 76:aeb1df146756 | 105 | #define ADC_ClockMode_SynClkDiv4 ADC_CFGR2_CKMODE_1 /*!< Synchronous clock mode divided by 4 */ |
mbed_official | 76:aeb1df146756 | 106 | #define IS_ADC_CLOCKMODE(CLOCK) (((CLOCK) == ADC_ClockMode_AsynClk) ||\ |
mbed_official | 76:aeb1df146756 | 107 | ((CLOCK) == ADC_ClockMode_SynClkDiv2) ||\ |
mbed_official | 76:aeb1df146756 | 108 | ((CLOCK) == ADC_ClockMode_SynClkDiv4)) |
mbed_official | 76:aeb1df146756 | 109 | |
mbed_official | 76:aeb1df146756 | 110 | /** |
mbed_official | 76:aeb1df146756 | 111 | * @} |
mbed_official | 76:aeb1df146756 | 112 | */ |
mbed_official | 76:aeb1df146756 | 113 | |
mbed_official | 76:aeb1df146756 | 114 | /** @defgroup ADC_Resolution |
mbed_official | 76:aeb1df146756 | 115 | * @{ |
mbed_official | 76:aeb1df146756 | 116 | */ |
mbed_official | 76:aeb1df146756 | 117 | #define ADC_Resolution_12b ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 118 | #define ADC_Resolution_10b ADC_CFGR1_RES_0 |
mbed_official | 76:aeb1df146756 | 119 | #define ADC_Resolution_8b ADC_CFGR1_RES_1 |
mbed_official | 76:aeb1df146756 | 120 | #define ADC_Resolution_6b ADC_CFGR1_RES |
mbed_official | 76:aeb1df146756 | 121 | |
mbed_official | 76:aeb1df146756 | 122 | #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_Resolution_12b) || \ |
mbed_official | 76:aeb1df146756 | 123 | ((RESOLUTION) == ADC_Resolution_10b) || \ |
mbed_official | 76:aeb1df146756 | 124 | ((RESOLUTION) == ADC_Resolution_8b) || \ |
mbed_official | 76:aeb1df146756 | 125 | ((RESOLUTION) == ADC_Resolution_6b)) |
mbed_official | 76:aeb1df146756 | 126 | |
mbed_official | 76:aeb1df146756 | 127 | /** |
mbed_official | 76:aeb1df146756 | 128 | * @} |
mbed_official | 76:aeb1df146756 | 129 | */ |
mbed_official | 76:aeb1df146756 | 130 | |
mbed_official | 76:aeb1df146756 | 131 | /** @defgroup ADC_external_trigger_edge_conversion |
mbed_official | 76:aeb1df146756 | 132 | * @{ |
mbed_official | 76:aeb1df146756 | 133 | */ |
mbed_official | 76:aeb1df146756 | 134 | #define ADC_ExternalTrigConvEdge_None ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 135 | #define ADC_ExternalTrigConvEdge_Rising ADC_CFGR1_EXTEN_0 |
mbed_official | 76:aeb1df146756 | 136 | #define ADC_ExternalTrigConvEdge_Falling ADC_CFGR1_EXTEN_1 |
mbed_official | 76:aeb1df146756 | 137 | #define ADC_ExternalTrigConvEdge_RisingFalling ADC_CFGR1_EXTEN |
mbed_official | 76:aeb1df146756 | 138 | |
mbed_official | 76:aeb1df146756 | 139 | #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigConvEdge_None) || \ |
mbed_official | 76:aeb1df146756 | 140 | ((EDGE) == ADC_ExternalTrigConvEdge_Rising) || \ |
mbed_official | 76:aeb1df146756 | 141 | ((EDGE) == ADC_ExternalTrigConvEdge_Falling) || \ |
mbed_official | 76:aeb1df146756 | 142 | ((EDGE) == ADC_ExternalTrigConvEdge_RisingFalling)) |
mbed_official | 76:aeb1df146756 | 143 | /** |
mbed_official | 76:aeb1df146756 | 144 | * @} |
mbed_official | 76:aeb1df146756 | 145 | */ |
mbed_official | 76:aeb1df146756 | 146 | |
mbed_official | 76:aeb1df146756 | 147 | /** @defgroup ADC_external_trigger_sources_for_channels_conversion |
mbed_official | 76:aeb1df146756 | 148 | * @{ |
mbed_official | 76:aeb1df146756 | 149 | */ |
mbed_official | 76:aeb1df146756 | 150 | |
mbed_official | 76:aeb1df146756 | 151 | /* TIM1 */ |
mbed_official | 76:aeb1df146756 | 152 | #define ADC_ExternalTrigConv_T1_TRGO ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 153 | #define ADC_ExternalTrigConv_T1_CC4 ADC_CFGR1_EXTSEL_0 |
mbed_official | 76:aeb1df146756 | 154 | |
mbed_official | 76:aeb1df146756 | 155 | /* TIM2 */ |
mbed_official | 76:aeb1df146756 | 156 | #define ADC_ExternalTrigConv_T2_TRGO ADC_CFGR1_EXTSEL_1 |
mbed_official | 76:aeb1df146756 | 157 | |
mbed_official | 76:aeb1df146756 | 158 | /* TIM3 */ |
mbed_official | 76:aeb1df146756 | 159 | #define ADC_ExternalTrigConv_T3_TRGO ((uint32_t)(ADC_CFGR1_EXTSEL_0 | ADC_CFGR1_EXTSEL_1)) |
mbed_official | 76:aeb1df146756 | 160 | |
mbed_official | 76:aeb1df146756 | 161 | /* TIM15 */ |
mbed_official | 76:aeb1df146756 | 162 | #define ADC_ExternalTrigConv_T15_TRGO ADC_CFGR1_EXTSEL_2 |
mbed_official | 76:aeb1df146756 | 163 | |
mbed_official | 76:aeb1df146756 | 164 | #define IS_ADC_EXTERNAL_TRIG_CONV(CONV) (((CONV) == ADC_ExternalTrigConv_T1_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 165 | ((CONV) == ADC_ExternalTrigConv_T1_CC4) || \ |
mbed_official | 76:aeb1df146756 | 166 | ((CONV) == ADC_ExternalTrigConv_T2_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 167 | ((CONV) == ADC_ExternalTrigConv_T3_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 168 | ((CONV) == ADC_ExternalTrigConv_T15_TRGO)) |
mbed_official | 76:aeb1df146756 | 169 | /** |
mbed_official | 76:aeb1df146756 | 170 | * @} |
mbed_official | 76:aeb1df146756 | 171 | */ |
mbed_official | 76:aeb1df146756 | 172 | |
mbed_official | 76:aeb1df146756 | 173 | /** @defgroup ADC_data_align |
mbed_official | 76:aeb1df146756 | 174 | * @{ |
mbed_official | 76:aeb1df146756 | 175 | */ |
mbed_official | 76:aeb1df146756 | 176 | |
mbed_official | 76:aeb1df146756 | 177 | #define ADC_DataAlign_Right ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 178 | #define ADC_DataAlign_Left ADC_CFGR1_ALIGN |
mbed_official | 76:aeb1df146756 | 179 | |
mbed_official | 76:aeb1df146756 | 180 | #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \ |
mbed_official | 76:aeb1df146756 | 181 | ((ALIGN) == ADC_DataAlign_Left)) |
mbed_official | 76:aeb1df146756 | 182 | /** |
mbed_official | 76:aeb1df146756 | 183 | * @} |
mbed_official | 76:aeb1df146756 | 184 | */ |
mbed_official | 76:aeb1df146756 | 185 | |
mbed_official | 76:aeb1df146756 | 186 | /** @defgroup ADC_Scan_Direction |
mbed_official | 76:aeb1df146756 | 187 | * @{ |
mbed_official | 76:aeb1df146756 | 188 | */ |
mbed_official | 76:aeb1df146756 | 189 | |
mbed_official | 76:aeb1df146756 | 190 | #define ADC_ScanDirection_Upward ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 191 | #define ADC_ScanDirection_Backward ADC_CFGR1_SCANDIR |
mbed_official | 76:aeb1df146756 | 192 | |
mbed_official | 76:aeb1df146756 | 193 | #define IS_ADC_SCAN_DIRECTION(DIRECTION) (((DIRECTION) == ADC_ScanDirection_Upward) || \ |
mbed_official | 76:aeb1df146756 | 194 | ((DIRECTION) == ADC_ScanDirection_Backward)) |
mbed_official | 76:aeb1df146756 | 195 | /** |
mbed_official | 76:aeb1df146756 | 196 | * @} |
mbed_official | 76:aeb1df146756 | 197 | */ |
mbed_official | 76:aeb1df146756 | 198 | |
mbed_official | 76:aeb1df146756 | 199 | /** @defgroup ADC_DMA_Mode |
mbed_official | 76:aeb1df146756 | 200 | * @{ |
mbed_official | 76:aeb1df146756 | 201 | */ |
mbed_official | 76:aeb1df146756 | 202 | |
mbed_official | 76:aeb1df146756 | 203 | #define ADC_DMAMode_OneShot ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 204 | #define ADC_DMAMode_Circular ADC_CFGR1_DMACFG |
mbed_official | 76:aeb1df146756 | 205 | |
mbed_official | 76:aeb1df146756 | 206 | #define IS_ADC_DMA_MODE(MODE) (((MODE) == ADC_DMAMode_OneShot) || \ |
mbed_official | 76:aeb1df146756 | 207 | ((MODE) == ADC_DMAMode_Circular)) |
mbed_official | 76:aeb1df146756 | 208 | /** |
mbed_official | 76:aeb1df146756 | 209 | * @} |
mbed_official | 76:aeb1df146756 | 210 | */ |
mbed_official | 76:aeb1df146756 | 211 | |
mbed_official | 76:aeb1df146756 | 212 | /** @defgroup ADC_analog_watchdog_selection |
mbed_official | 76:aeb1df146756 | 213 | * @{ |
mbed_official | 76:aeb1df146756 | 214 | */ |
mbed_official | 76:aeb1df146756 | 215 | |
mbed_official | 76:aeb1df146756 | 216 | #define ADC_AnalogWatchdog_Channel_0 ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 217 | #define ADC_AnalogWatchdog_Channel_1 ((uint32_t)0x04000000) |
mbed_official | 76:aeb1df146756 | 218 | #define ADC_AnalogWatchdog_Channel_2 ((uint32_t)0x08000000) |
mbed_official | 76:aeb1df146756 | 219 | #define ADC_AnalogWatchdog_Channel_3 ((uint32_t)0x0C000000) |
mbed_official | 76:aeb1df146756 | 220 | #define ADC_AnalogWatchdog_Channel_4 ((uint32_t)0x10000000) |
mbed_official | 76:aeb1df146756 | 221 | #define ADC_AnalogWatchdog_Channel_5 ((uint32_t)0x14000000) |
mbed_official | 76:aeb1df146756 | 222 | #define ADC_AnalogWatchdog_Channel_6 ((uint32_t)0x18000000) |
mbed_official | 76:aeb1df146756 | 223 | #define ADC_AnalogWatchdog_Channel_7 ((uint32_t)0x1C000000) |
mbed_official | 76:aeb1df146756 | 224 | #define ADC_AnalogWatchdog_Channel_8 ((uint32_t)0x20000000) |
mbed_official | 76:aeb1df146756 | 225 | #define ADC_AnalogWatchdog_Channel_9 ((uint32_t)0x24000000) |
mbed_official | 76:aeb1df146756 | 226 | #define ADC_AnalogWatchdog_Channel_10 ((uint32_t)0x28000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 227 | #define ADC_AnalogWatchdog_Channel_11 ((uint32_t)0x2C000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 228 | #define ADC_AnalogWatchdog_Channel_12 ((uint32_t)0x30000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 229 | #define ADC_AnalogWatchdog_Channel_13 ((uint32_t)0x34000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 230 | #define ADC_AnalogWatchdog_Channel_14 ((uint32_t)0x38000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 231 | #define ADC_AnalogWatchdog_Channel_15 ((uint32_t)0x3C000000) /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 232 | #define ADC_AnalogWatchdog_Channel_16 ((uint32_t)0x40000000) |
mbed_official | 76:aeb1df146756 | 233 | #define ADC_AnalogWatchdog_Channel_17 ((uint32_t)0x44000000) |
mbed_official | 76:aeb1df146756 | 234 | #define ADC_AnalogWatchdog_Channel_18 ((uint32_t)0x48000000) |
mbed_official | 76:aeb1df146756 | 235 | |
mbed_official | 76:aeb1df146756 | 236 | |
mbed_official | 76:aeb1df146756 | 237 | #define IS_ADC_ANALOG_WATCHDOG_CHANNEL(CHANNEL) (((CHANNEL) == ADC_AnalogWatchdog_Channel_0) || \ |
mbed_official | 76:aeb1df146756 | 238 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_1) || \ |
mbed_official | 76:aeb1df146756 | 239 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_2) || \ |
mbed_official | 76:aeb1df146756 | 240 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_3) || \ |
mbed_official | 76:aeb1df146756 | 241 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_4) || \ |
mbed_official | 76:aeb1df146756 | 242 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_5) || \ |
mbed_official | 76:aeb1df146756 | 243 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_6) || \ |
mbed_official | 76:aeb1df146756 | 244 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_7) || \ |
mbed_official | 76:aeb1df146756 | 245 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_8) || \ |
mbed_official | 76:aeb1df146756 | 246 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_9) || \ |
mbed_official | 76:aeb1df146756 | 247 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_10) || \ |
mbed_official | 76:aeb1df146756 | 248 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_11) || \ |
mbed_official | 76:aeb1df146756 | 249 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_12) || \ |
mbed_official | 76:aeb1df146756 | 250 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_13) || \ |
mbed_official | 76:aeb1df146756 | 251 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_14) || \ |
mbed_official | 76:aeb1df146756 | 252 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_15) || \ |
mbed_official | 76:aeb1df146756 | 253 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_16) || \ |
mbed_official | 76:aeb1df146756 | 254 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_17) || \ |
mbed_official | 76:aeb1df146756 | 255 | ((CHANNEL) == ADC_AnalogWatchdog_Channel_18)) |
mbed_official | 76:aeb1df146756 | 256 | /** |
mbed_official | 76:aeb1df146756 | 257 | * @} |
mbed_official | 76:aeb1df146756 | 258 | */ |
mbed_official | 76:aeb1df146756 | 259 | |
mbed_official | 76:aeb1df146756 | 260 | /** @defgroup ADC_sampling_times |
mbed_official | 76:aeb1df146756 | 261 | * @{ |
mbed_official | 76:aeb1df146756 | 262 | */ |
mbed_official | 76:aeb1df146756 | 263 | |
mbed_official | 76:aeb1df146756 | 264 | #define ADC_SampleTime_1_5Cycles ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 265 | #define ADC_SampleTime_7_5Cycles ((uint32_t)0x00000001) |
mbed_official | 76:aeb1df146756 | 266 | #define ADC_SampleTime_13_5Cycles ((uint32_t)0x00000002) |
mbed_official | 76:aeb1df146756 | 267 | #define ADC_SampleTime_28_5Cycles ((uint32_t)0x00000003) |
mbed_official | 76:aeb1df146756 | 268 | #define ADC_SampleTime_41_5Cycles ((uint32_t)0x00000004) |
mbed_official | 76:aeb1df146756 | 269 | #define ADC_SampleTime_55_5Cycles ((uint32_t)0x00000005) |
mbed_official | 76:aeb1df146756 | 270 | #define ADC_SampleTime_71_5Cycles ((uint32_t)0x00000006) |
mbed_official | 76:aeb1df146756 | 271 | #define ADC_SampleTime_239_5Cycles ((uint32_t)0x00000007) |
mbed_official | 76:aeb1df146756 | 272 | |
mbed_official | 76:aeb1df146756 | 273 | #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_1_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 274 | ((TIME) == ADC_SampleTime_7_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 275 | ((TIME) == ADC_SampleTime_13_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 276 | ((TIME) == ADC_SampleTime_28_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 277 | ((TIME) == ADC_SampleTime_41_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 278 | ((TIME) == ADC_SampleTime_55_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 279 | ((TIME) == ADC_SampleTime_71_5Cycles) || \ |
mbed_official | 76:aeb1df146756 | 280 | ((TIME) == ADC_SampleTime_239_5Cycles)) |
mbed_official | 76:aeb1df146756 | 281 | /** |
mbed_official | 76:aeb1df146756 | 282 | * @} |
mbed_official | 76:aeb1df146756 | 283 | */ |
mbed_official | 76:aeb1df146756 | 284 | |
mbed_official | 76:aeb1df146756 | 285 | /** @defgroup ADC_thresholds |
mbed_official | 76:aeb1df146756 | 286 | * @{ |
mbed_official | 76:aeb1df146756 | 287 | */ |
mbed_official | 76:aeb1df146756 | 288 | |
mbed_official | 76:aeb1df146756 | 289 | #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF) |
mbed_official | 76:aeb1df146756 | 290 | |
mbed_official | 76:aeb1df146756 | 291 | /** |
mbed_official | 76:aeb1df146756 | 292 | * @} |
mbed_official | 76:aeb1df146756 | 293 | */ |
mbed_official | 76:aeb1df146756 | 294 | |
mbed_official | 76:aeb1df146756 | 295 | /** @defgroup ADC_channels |
mbed_official | 76:aeb1df146756 | 296 | * @{ |
mbed_official | 76:aeb1df146756 | 297 | */ |
mbed_official | 76:aeb1df146756 | 298 | |
mbed_official | 76:aeb1df146756 | 299 | #define ADC_Channel_0 ADC_CHSELR_CHSEL0 |
mbed_official | 76:aeb1df146756 | 300 | #define ADC_Channel_1 ADC_CHSELR_CHSEL1 |
mbed_official | 76:aeb1df146756 | 301 | #define ADC_Channel_2 ADC_CHSELR_CHSEL2 |
mbed_official | 76:aeb1df146756 | 302 | #define ADC_Channel_3 ADC_CHSELR_CHSEL3 |
mbed_official | 76:aeb1df146756 | 303 | #define ADC_Channel_4 ADC_CHSELR_CHSEL4 |
mbed_official | 76:aeb1df146756 | 304 | #define ADC_Channel_5 ADC_CHSELR_CHSEL5 |
mbed_official | 76:aeb1df146756 | 305 | #define ADC_Channel_6 ADC_CHSELR_CHSEL6 |
mbed_official | 76:aeb1df146756 | 306 | #define ADC_Channel_7 ADC_CHSELR_CHSEL7 |
mbed_official | 76:aeb1df146756 | 307 | #define ADC_Channel_8 ADC_CHSELR_CHSEL8 |
mbed_official | 76:aeb1df146756 | 308 | #define ADC_Channel_9 ADC_CHSELR_CHSEL9 |
mbed_official | 76:aeb1df146756 | 309 | #define ADC_Channel_10 ADC_CHSELR_CHSEL10 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 310 | #define ADC_Channel_11 ADC_CHSELR_CHSEL11 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 311 | #define ADC_Channel_12 ADC_CHSELR_CHSEL12 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 312 | #define ADC_Channel_13 ADC_CHSELR_CHSEL13 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 313 | #define ADC_Channel_14 ADC_CHSELR_CHSEL14 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 314 | #define ADC_Channel_15 ADC_CHSELR_CHSEL15 /*!< Not available for STM32F031 devices */ |
mbed_official | 76:aeb1df146756 | 315 | #define ADC_Channel_16 ADC_CHSELR_CHSEL16 |
mbed_official | 76:aeb1df146756 | 316 | #define ADC_Channel_17 ADC_CHSELR_CHSEL17 |
mbed_official | 76:aeb1df146756 | 317 | #define ADC_Channel_18 ADC_CHSELR_CHSEL18 /*!< Not available for STM32F030 devices */ |
mbed_official | 76:aeb1df146756 | 318 | |
mbed_official | 76:aeb1df146756 | 319 | #define ADC_Channel_TempSensor ((uint32_t)ADC_Channel_16) |
mbed_official | 76:aeb1df146756 | 320 | #define ADC_Channel_Vrefint ((uint32_t)ADC_Channel_17) |
mbed_official | 76:aeb1df146756 | 321 | #define ADC_Channel_Vbat ((uint32_t)ADC_Channel_18) /*!< Not available for STM32F030 devices */ |
mbed_official | 76:aeb1df146756 | 322 | |
mbed_official | 76:aeb1df146756 | 323 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) != (uint32_t)RESET) && (((CHANNEL) & 0xFFF80000) == (uint32_t)RESET)) |
mbed_official | 76:aeb1df146756 | 324 | |
mbed_official | 76:aeb1df146756 | 325 | /** |
mbed_official | 76:aeb1df146756 | 326 | * @} |
mbed_official | 76:aeb1df146756 | 327 | */ |
mbed_official | 76:aeb1df146756 | 328 | |
mbed_official | 76:aeb1df146756 | 329 | /** @defgroup ADC_interrupts_definition |
mbed_official | 76:aeb1df146756 | 330 | * @{ |
mbed_official | 76:aeb1df146756 | 331 | */ |
mbed_official | 76:aeb1df146756 | 332 | |
mbed_official | 76:aeb1df146756 | 333 | #define ADC_IT_ADRDY ADC_IER_ADRDYIE |
mbed_official | 76:aeb1df146756 | 334 | #define ADC_IT_EOSMP ADC_IER_EOSMPIE |
mbed_official | 76:aeb1df146756 | 335 | #define ADC_IT_EOC ADC_IER_EOCIE |
mbed_official | 76:aeb1df146756 | 336 | #define ADC_IT_EOSEQ ADC_IER_EOSEQIE |
mbed_official | 76:aeb1df146756 | 337 | #define ADC_IT_OVR ADC_IER_OVRIE |
mbed_official | 76:aeb1df146756 | 338 | #define ADC_IT_AWD ADC_IER_AWDIE |
mbed_official | 76:aeb1df146756 | 339 | |
mbed_official | 76:aeb1df146756 | 340 | #define IS_ADC_CONFIG_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFFFF60) == (uint32_t)RESET)) |
mbed_official | 76:aeb1df146756 | 341 | |
mbed_official | 76:aeb1df146756 | 342 | #define IS_ADC_GET_IT(IT) (((IT) == ADC_IT_ADRDY) || ((IT) == ADC_IT_EOSMP) || \ |
mbed_official | 76:aeb1df146756 | 343 | ((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_EOSEQ) || \ |
mbed_official | 76:aeb1df146756 | 344 | ((IT) == ADC_IT_OVR) || ((IT) == ADC_IT_AWD)) |
mbed_official | 76:aeb1df146756 | 345 | |
mbed_official | 76:aeb1df146756 | 346 | #define IS_ADC_CLEAR_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFFFF60) == (uint32_t)RESET)) |
mbed_official | 76:aeb1df146756 | 347 | |
mbed_official | 76:aeb1df146756 | 348 | /** |
mbed_official | 76:aeb1df146756 | 349 | * @} |
mbed_official | 76:aeb1df146756 | 350 | */ |
mbed_official | 76:aeb1df146756 | 351 | |
mbed_official | 76:aeb1df146756 | 352 | /** @defgroup ADC_flags_definition |
mbed_official | 76:aeb1df146756 | 353 | * @{ |
mbed_official | 76:aeb1df146756 | 354 | */ |
mbed_official | 76:aeb1df146756 | 355 | |
mbed_official | 76:aeb1df146756 | 356 | #define ADC_FLAG_ADRDY ADC_ISR_ADRDY |
mbed_official | 76:aeb1df146756 | 357 | #define ADC_FLAG_EOSMP ADC_ISR_EOSMP |
mbed_official | 76:aeb1df146756 | 358 | #define ADC_FLAG_EOC ADC_ISR_EOC |
mbed_official | 76:aeb1df146756 | 359 | #define ADC_FLAG_EOSEQ ADC_ISR_EOSEQ |
mbed_official | 76:aeb1df146756 | 360 | #define ADC_FLAG_OVR ADC_ISR_OVR |
mbed_official | 76:aeb1df146756 | 361 | #define ADC_FLAG_AWD ADC_ISR_AWD |
mbed_official | 76:aeb1df146756 | 362 | |
mbed_official | 76:aeb1df146756 | 363 | #define ADC_FLAG_ADEN ((uint32_t)0x01000001) |
mbed_official | 76:aeb1df146756 | 364 | #define ADC_FLAG_ADDIS ((uint32_t)0x01000002) |
mbed_official | 76:aeb1df146756 | 365 | #define ADC_FLAG_ADSTART ((uint32_t)0x01000004) |
mbed_official | 76:aeb1df146756 | 366 | #define ADC_FLAG_ADSTP ((uint32_t)0x01000010) |
mbed_official | 76:aeb1df146756 | 367 | #define ADC_FLAG_ADCAL ((uint32_t)0x81000000) |
mbed_official | 76:aeb1df146756 | 368 | |
mbed_official | 76:aeb1df146756 | 369 | #define IS_ADC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFFFF60) == (uint32_t)RESET)) |
mbed_official | 76:aeb1df146756 | 370 | |
mbed_official | 76:aeb1df146756 | 371 | #define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_ADRDY) || ((FLAG) == ADC_FLAG_EOSMP) || \ |
mbed_official | 76:aeb1df146756 | 372 | ((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_EOSEQ) || \ |
mbed_official | 76:aeb1df146756 | 373 | ((FLAG) == ADC_FLAG_AWD) || ((FLAG) == ADC_FLAG_OVR) || \ |
mbed_official | 76:aeb1df146756 | 374 | ((FLAG) == ADC_FLAG_ADEN) || ((FLAG) == ADC_FLAG_ADDIS) || \ |
mbed_official | 76:aeb1df146756 | 375 | ((FLAG) == ADC_FLAG_ADSTART) || ((FLAG) == ADC_FLAG_ADSTP) || \ |
mbed_official | 76:aeb1df146756 | 376 | ((FLAG) == ADC_FLAG_ADCAL)) |
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 | /** |
mbed_official | 76:aeb1df146756 | 382 | * @} |
mbed_official | 76:aeb1df146756 | 383 | */ |
mbed_official | 76:aeb1df146756 | 384 | |
mbed_official | 76:aeb1df146756 | 385 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 386 | /* Exported functions ------------------------------------------------------- */ |
mbed_official | 76:aeb1df146756 | 387 | |
mbed_official | 76:aeb1df146756 | 388 | /* Function used to set the ADC configuration to the default reset state *****/ |
mbed_official | 76:aeb1df146756 | 389 | void ADC_DeInit(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 390 | |
mbed_official | 76:aeb1df146756 | 391 | /* Initialization and Configuration functions *********************************/ |
mbed_official | 76:aeb1df146756 | 392 | void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct); |
mbed_official | 76:aeb1df146756 | 393 | void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct); |
mbed_official | 76:aeb1df146756 | 394 | void ADC_ClockModeConfig(ADC_TypeDef* ADCx, uint32_t ADC_ClockMode); |
mbed_official | 76:aeb1df146756 | 395 | void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 396 | /* This Function is obsolete and maintained for legacy purpose only. |
mbed_official | 76:aeb1df146756 | 397 | ADC_ClockModeConfig() function should be used instead */ |
mbed_official | 76:aeb1df146756 | 398 | void ADC_JitterCmd(ADC_TypeDef* ADCx, uint32_t ADC_JitterOff, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 399 | |
mbed_official | 76:aeb1df146756 | 400 | /* Power saving functions *****************************************************/ |
mbed_official | 76:aeb1df146756 | 401 | void ADC_AutoPowerOffCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 402 | void ADC_WaitModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 403 | |
mbed_official | 76:aeb1df146756 | 404 | /* Analog Watchdog configuration functions ************************************/ |
mbed_official | 76:aeb1df146756 | 405 | void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 406 | void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold,uint16_t LowThreshold); |
mbed_official | 76:aeb1df146756 | 407 | void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog_Channel); |
mbed_official | 76:aeb1df146756 | 408 | void ADC_AnalogWatchdogSingleChannelCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 409 | |
mbed_official | 76:aeb1df146756 | 410 | /* Temperature Sensor , Vrefint and Vbat management function ******************/ |
mbed_official | 76:aeb1df146756 | 411 | void ADC_TempSensorCmd(FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 412 | void ADC_VrefintCmd(FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 413 | void ADC_VbatCmd(FunctionalState NewState); /*!< Not applicable for STM32F030 devices */ |
mbed_official | 76:aeb1df146756 | 414 | |
mbed_official | 76:aeb1df146756 | 415 | /* Channels Configuration functions *******************************************/ |
mbed_official | 76:aeb1df146756 | 416 | void ADC_ChannelConfig(ADC_TypeDef* ADCx, uint32_t ADC_Channel, uint32_t ADC_SampleTime); |
mbed_official | 76:aeb1df146756 | 417 | void ADC_ContinuousModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 418 | void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 419 | void ADC_OverrunModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 420 | uint32_t ADC_GetCalibrationFactor(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 421 | void ADC_StopOfConversion(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 422 | void ADC_StartOfConversion(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 423 | uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 424 | |
mbed_official | 76:aeb1df146756 | 425 | /* Regular Channels DMA Configuration functions *******************************/ |
mbed_official | 76:aeb1df146756 | 426 | void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 427 | void ADC_DMARequestModeConfig(ADC_TypeDef* ADCx, uint32_t ADC_DMARequestMode); |
mbed_official | 76:aeb1df146756 | 428 | |
mbed_official | 76:aeb1df146756 | 429 | /* Interrupts and flags management functions **********************************/ |
mbed_official | 76:aeb1df146756 | 430 | void ADC_ITConfig(ADC_TypeDef* ADCx, uint32_t ADC_IT, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 431 | FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint32_t ADC_FLAG); |
mbed_official | 76:aeb1df146756 | 432 | void ADC_ClearFlag(ADC_TypeDef* ADCx, uint32_t ADC_FLAG); |
mbed_official | 76:aeb1df146756 | 433 | ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint32_t ADC_IT); |
mbed_official | 76:aeb1df146756 | 434 | void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint32_t ADC_IT); |
mbed_official | 76:aeb1df146756 | 435 | |
mbed_official | 76:aeb1df146756 | 436 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 437 | } |
mbed_official | 76:aeb1df146756 | 438 | #endif |
mbed_official | 76:aeb1df146756 | 439 | |
mbed_official | 76:aeb1df146756 | 440 | #endif /*__STM32F0XX_ADC_H */ |
mbed_official | 76:aeb1df146756 | 441 | |
mbed_official | 76:aeb1df146756 | 442 | /** |
mbed_official | 76:aeb1df146756 | 443 | * @} |
mbed_official | 76:aeb1df146756 | 444 | */ |
mbed_official | 76:aeb1df146756 | 445 | |
mbed_official | 76:aeb1df146756 | 446 | /** |
mbed_official | 76:aeb1df146756 | 447 | * @} |
mbed_official | 76:aeb1df146756 | 448 | */ |
mbed_official | 76:aeb1df146756 | 449 | |
mbed_official | 76:aeb1df146756 | 450 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |