mbed library with additional peripherals for ST F401 board
Fork of mbed-src by
This mbed LIB has additional peripherals for ST F401 board
- UART2 : PA_3 rx, PA_2 tx
- UART3 : PC_7 rx, PC_6 tx
- I2C2 : PB_3 SDA, PB_10 SCL
- I2C3 : PB_4 SDA, PA_8 SCL
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_adc.h@76:aeb1df146756, 2014-01-27 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 27 14:30:07 2014 +0000
- Revision:
- 76:aeb1df146756
- Child:
- 80:66393a7b209d
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 stm32l1xx_adc.h |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.2.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 22-February-2013 |
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 2013 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 __STM32L1xx_ADC_H |
mbed_official | 76:aeb1df146756 | 31 | #define __STM32L1xx_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 "stm32l1xx.h" |
mbed_official | 76:aeb1df146756 | 39 | |
mbed_official | 76:aeb1df146756 | 40 | /** @addtogroup STM32L1xx_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_ScanConvMode; /*!< Specifies whether the conversion is performed in |
mbed_official | 76:aeb1df146756 | 60 | Scan (multichannel) or Single (one channel) 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 | FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed in |
mbed_official | 76:aeb1df146756 | 64 | Continuous or Single mode. |
mbed_official | 76:aeb1df146756 | 65 | This parameter can be set to ENABLE or DISABLE. */ |
mbed_official | 76:aeb1df146756 | 66 | |
mbed_official | 76:aeb1df146756 | 67 | uint32_t ADC_ExternalTrigConvEdge; /*!< Selects the external trigger Edge and enables the |
mbed_official | 76:aeb1df146756 | 68 | trigger of a regular group. This parameter can be a value |
mbed_official | 76:aeb1df146756 | 69 | of @ref ADC_external_trigger_edge_for_regular_channels_conversion */ |
mbed_official | 76:aeb1df146756 | 70 | |
mbed_official | 76:aeb1df146756 | 71 | uint32_t ADC_ExternalTrigConv; /*!< Defines the external trigger used to start the analog |
mbed_official | 76:aeb1df146756 | 72 | to digital conversion of regular channels. This parameter |
mbed_official | 76:aeb1df146756 | 73 | can be a value of @ref ADC_external_trigger_sources_for_regular_channels_conversion */ |
mbed_official | 76:aeb1df146756 | 74 | |
mbed_official | 76:aeb1df146756 | 75 | uint32_t ADC_DataAlign; /*!< Specifies whether the ADC data alignment is left or right. |
mbed_official | 76:aeb1df146756 | 76 | This parameter can be a value of @ref ADC_data_align */ |
mbed_official | 76:aeb1df146756 | 77 | |
mbed_official | 76:aeb1df146756 | 78 | uint8_t ADC_NbrOfConversion; /*!< Specifies the number of ADC conversions that will be done |
mbed_official | 76:aeb1df146756 | 79 | using the sequencer for regular channel group. |
mbed_official | 76:aeb1df146756 | 80 | This parameter must range from 1 to 27. */ |
mbed_official | 76:aeb1df146756 | 81 | }ADC_InitTypeDef; |
mbed_official | 76:aeb1df146756 | 82 | |
mbed_official | 76:aeb1df146756 | 83 | typedef struct |
mbed_official | 76:aeb1df146756 | 84 | { |
mbed_official | 76:aeb1df146756 | 85 | uint32_t ADC_Prescaler; /*!< Selects the ADC prescaler. |
mbed_official | 76:aeb1df146756 | 86 | This parameter can be a value |
mbed_official | 76:aeb1df146756 | 87 | of @ref ADC_Prescaler */ |
mbed_official | 76:aeb1df146756 | 88 | }ADC_CommonInitTypeDef; |
mbed_official | 76:aeb1df146756 | 89 | |
mbed_official | 76:aeb1df146756 | 90 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 91 | |
mbed_official | 76:aeb1df146756 | 92 | /** @defgroup ADC_Exported_Constants |
mbed_official | 76:aeb1df146756 | 93 | * @{ |
mbed_official | 76:aeb1df146756 | 94 | */ |
mbed_official | 76:aeb1df146756 | 95 | #define IS_ADC_ALL_PERIPH(PERIPH) ((PERIPH) == ADC1) |
mbed_official | 76:aeb1df146756 | 96 | #define IS_ADC_DMA_PERIPH(PERIPH) ((PERIPH) == ADC1) |
mbed_official | 76:aeb1df146756 | 97 | |
mbed_official | 76:aeb1df146756 | 98 | /** @defgroup ADC_Power_down_during_Idle_and_or_Delay_phase |
mbed_official | 76:aeb1df146756 | 99 | * @{ |
mbed_official | 76:aeb1df146756 | 100 | */ |
mbed_official | 76:aeb1df146756 | 101 | #define ADC_PowerDown_Delay ((uint32_t)0x00010000) |
mbed_official | 76:aeb1df146756 | 102 | #define ADC_PowerDown_Idle ((uint32_t)0x00020000) |
mbed_official | 76:aeb1df146756 | 103 | #define ADC_PowerDown_Idle_Delay ((uint32_t)0x00030000) |
mbed_official | 76:aeb1df146756 | 104 | |
mbed_official | 76:aeb1df146756 | 105 | #define IS_ADC_POWER_DOWN(DWON) (((DWON) == ADC_PowerDown_Delay) || \ |
mbed_official | 76:aeb1df146756 | 106 | ((DWON) == ADC_PowerDown_Idle) || \ |
mbed_official | 76:aeb1df146756 | 107 | ((DWON) == ADC_PowerDown_Idle_Delay)) |
mbed_official | 76:aeb1df146756 | 108 | /** |
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 | /** @defgroup ADC_Prescaler |
mbed_official | 76:aeb1df146756 | 114 | * @{ |
mbed_official | 76:aeb1df146756 | 115 | */ |
mbed_official | 76:aeb1df146756 | 116 | #define ADC_Prescaler_Div1 ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 117 | #define ADC_Prescaler_Div2 ((uint32_t)0x00010000) |
mbed_official | 76:aeb1df146756 | 118 | #define ADC_Prescaler_Div4 ((uint32_t)0x00020000) |
mbed_official | 76:aeb1df146756 | 119 | |
mbed_official | 76:aeb1df146756 | 120 | #define IS_ADC_PRESCALER(PRESCALER) (((PRESCALER) == ADC_Prescaler_Div1) || \ |
mbed_official | 76:aeb1df146756 | 121 | ((PRESCALER) == ADC_Prescaler_Div2) || \ |
mbed_official | 76:aeb1df146756 | 122 | ((PRESCALER) == ADC_Prescaler_Div4)) |
mbed_official | 76:aeb1df146756 | 123 | /** |
mbed_official | 76:aeb1df146756 | 124 | * @} |
mbed_official | 76:aeb1df146756 | 125 | */ |
mbed_official | 76:aeb1df146756 | 126 | |
mbed_official | 76:aeb1df146756 | 127 | |
mbed_official | 76:aeb1df146756 | 128 | |
mbed_official | 76:aeb1df146756 | 129 | /** @defgroup ADC_Resolution |
mbed_official | 76:aeb1df146756 | 130 | * @{ |
mbed_official | 76:aeb1df146756 | 131 | */ |
mbed_official | 76:aeb1df146756 | 132 | #define ADC_Resolution_12b ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 133 | #define ADC_Resolution_10b ((uint32_t)0x01000000) |
mbed_official | 76:aeb1df146756 | 134 | #define ADC_Resolution_8b ((uint32_t)0x02000000) |
mbed_official | 76:aeb1df146756 | 135 | #define ADC_Resolution_6b ((uint32_t)0x03000000) |
mbed_official | 76:aeb1df146756 | 136 | |
mbed_official | 76:aeb1df146756 | 137 | #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_Resolution_12b) || \ |
mbed_official | 76:aeb1df146756 | 138 | ((RESOLUTION) == ADC_Resolution_10b) || \ |
mbed_official | 76:aeb1df146756 | 139 | ((RESOLUTION) == ADC_Resolution_8b) || \ |
mbed_official | 76:aeb1df146756 | 140 | ((RESOLUTION) == ADC_Resolution_6b)) |
mbed_official | 76:aeb1df146756 | 141 | |
mbed_official | 76:aeb1df146756 | 142 | /** |
mbed_official | 76:aeb1df146756 | 143 | * @} |
mbed_official | 76:aeb1df146756 | 144 | */ |
mbed_official | 76:aeb1df146756 | 145 | |
mbed_official | 76:aeb1df146756 | 146 | /** @defgroup ADC_external_trigger_edge_for_regular_channels_conversion |
mbed_official | 76:aeb1df146756 | 147 | * @{ |
mbed_official | 76:aeb1df146756 | 148 | */ |
mbed_official | 76:aeb1df146756 | 149 | #define ADC_ExternalTrigConvEdge_None ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 150 | #define ADC_ExternalTrigConvEdge_Rising ((uint32_t)0x10000000) |
mbed_official | 76:aeb1df146756 | 151 | #define ADC_ExternalTrigConvEdge_Falling ((uint32_t)0x20000000) |
mbed_official | 76:aeb1df146756 | 152 | #define ADC_ExternalTrigConvEdge_RisingFalling ((uint32_t)0x30000000) |
mbed_official | 76:aeb1df146756 | 153 | |
mbed_official | 76:aeb1df146756 | 154 | #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigConvEdge_None) || \ |
mbed_official | 76:aeb1df146756 | 155 | ((EDGE) == ADC_ExternalTrigConvEdge_Rising) || \ |
mbed_official | 76:aeb1df146756 | 156 | ((EDGE) == ADC_ExternalTrigConvEdge_Falling) || \ |
mbed_official | 76:aeb1df146756 | 157 | ((EDGE) == ADC_ExternalTrigConvEdge_RisingFalling)) |
mbed_official | 76:aeb1df146756 | 158 | /** |
mbed_official | 76:aeb1df146756 | 159 | * @} |
mbed_official | 76:aeb1df146756 | 160 | */ |
mbed_official | 76:aeb1df146756 | 161 | |
mbed_official | 76:aeb1df146756 | 162 | /** @defgroup ADC_external_trigger_sources_for_regular_channels_conversion |
mbed_official | 76:aeb1df146756 | 163 | * @{ |
mbed_official | 76:aeb1df146756 | 164 | */ |
mbed_official | 76:aeb1df146756 | 165 | |
mbed_official | 76:aeb1df146756 | 166 | /* TIM2 */ |
mbed_official | 76:aeb1df146756 | 167 | #define ADC_ExternalTrigConv_T2_CC3 ((uint32_t)0x02000000) |
mbed_official | 76:aeb1df146756 | 168 | #define ADC_ExternalTrigConv_T2_CC2 ((uint32_t)0x03000000) |
mbed_official | 76:aeb1df146756 | 169 | #define ADC_ExternalTrigConv_T2_TRGO ((uint32_t)0x06000000) |
mbed_official | 76:aeb1df146756 | 170 | |
mbed_official | 76:aeb1df146756 | 171 | /* TIM3 */ |
mbed_official | 76:aeb1df146756 | 172 | #define ADC_ExternalTrigConv_T3_CC1 ((uint32_t)0x07000000) |
mbed_official | 76:aeb1df146756 | 173 | #define ADC_ExternalTrigConv_T3_CC3 ((uint32_t)0x08000000) |
mbed_official | 76:aeb1df146756 | 174 | #define ADC_ExternalTrigConv_T3_TRGO ((uint32_t)0x04000000) |
mbed_official | 76:aeb1df146756 | 175 | |
mbed_official | 76:aeb1df146756 | 176 | /* TIM4 */ |
mbed_official | 76:aeb1df146756 | 177 | #define ADC_ExternalTrigConv_T4_CC4 ((uint32_t)0x05000000) |
mbed_official | 76:aeb1df146756 | 178 | #define ADC_ExternalTrigConv_T4_TRGO ((uint32_t)0x09000000) |
mbed_official | 76:aeb1df146756 | 179 | |
mbed_official | 76:aeb1df146756 | 180 | /* TIM6 */ |
mbed_official | 76:aeb1df146756 | 181 | #define ADC_ExternalTrigConv_T6_TRGO ((uint32_t)0x0A000000) |
mbed_official | 76:aeb1df146756 | 182 | |
mbed_official | 76:aeb1df146756 | 183 | /* TIM9 */ |
mbed_official | 76:aeb1df146756 | 184 | #define ADC_ExternalTrigConv_T9_CC2 ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 185 | #define ADC_ExternalTrigConv_T9_TRGO ((uint32_t)0x01000000) |
mbed_official | 76:aeb1df146756 | 186 | |
mbed_official | 76:aeb1df146756 | 187 | /* EXTI */ |
mbed_official | 76:aeb1df146756 | 188 | #define ADC_ExternalTrigConv_Ext_IT11 ((uint32_t)0x0F000000) |
mbed_official | 76:aeb1df146756 | 189 | |
mbed_official | 76:aeb1df146756 | 190 | #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_ExternalTrigConv_T9_CC2) || \ |
mbed_official | 76:aeb1df146756 | 191 | ((REGTRIG) == ADC_ExternalTrigConv_T9_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 192 | ((REGTRIG) == ADC_ExternalTrigConv_T2_CC3) || \ |
mbed_official | 76:aeb1df146756 | 193 | ((REGTRIG) == ADC_ExternalTrigConv_T2_CC2) || \ |
mbed_official | 76:aeb1df146756 | 194 | ((REGTRIG) == ADC_ExternalTrigConv_T3_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 195 | ((REGTRIG) == ADC_ExternalTrigConv_T4_CC4) || \ |
mbed_official | 76:aeb1df146756 | 196 | ((REGTRIG) == ADC_ExternalTrigConv_T2_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 197 | ((REGTRIG) == ADC_ExternalTrigConv_T3_CC1) || \ |
mbed_official | 76:aeb1df146756 | 198 | ((REGTRIG) == ADC_ExternalTrigConv_T3_CC3) || \ |
mbed_official | 76:aeb1df146756 | 199 | ((REGTRIG) == ADC_ExternalTrigConv_T4_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 200 | ((REGTRIG) == ADC_ExternalTrigConv_T6_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 201 | ((REGTRIG) == ADC_ExternalTrigConv_Ext_IT11)) |
mbed_official | 76:aeb1df146756 | 202 | /** |
mbed_official | 76:aeb1df146756 | 203 | * @} |
mbed_official | 76:aeb1df146756 | 204 | */ |
mbed_official | 76:aeb1df146756 | 205 | |
mbed_official | 76:aeb1df146756 | 206 | /** @defgroup ADC_data_align |
mbed_official | 76:aeb1df146756 | 207 | * @{ |
mbed_official | 76:aeb1df146756 | 208 | */ |
mbed_official | 76:aeb1df146756 | 209 | |
mbed_official | 76:aeb1df146756 | 210 | #define ADC_DataAlign_Right ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 211 | #define ADC_DataAlign_Left ((uint32_t)0x00000800) |
mbed_official | 76:aeb1df146756 | 212 | |
mbed_official | 76:aeb1df146756 | 213 | #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \ |
mbed_official | 76:aeb1df146756 | 214 | ((ALIGN) == ADC_DataAlign_Left)) |
mbed_official | 76:aeb1df146756 | 215 | /** |
mbed_official | 76:aeb1df146756 | 216 | * @} |
mbed_official | 76:aeb1df146756 | 217 | */ |
mbed_official | 76:aeb1df146756 | 218 | |
mbed_official | 76:aeb1df146756 | 219 | /** @defgroup ADC_channels |
mbed_official | 76:aeb1df146756 | 220 | * @{ |
mbed_official | 76:aeb1df146756 | 221 | */ |
mbed_official | 76:aeb1df146756 | 222 | /* ADC Bank A Channels -------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 223 | #define ADC_Channel_0 ((uint8_t)0x00) |
mbed_official | 76:aeb1df146756 | 224 | #define ADC_Channel_1 ((uint8_t)0x01) |
mbed_official | 76:aeb1df146756 | 225 | #define ADC_Channel_2 ((uint8_t)0x02) |
mbed_official | 76:aeb1df146756 | 226 | #define ADC_Channel_3 ((uint8_t)0x03) |
mbed_official | 76:aeb1df146756 | 227 | |
mbed_official | 76:aeb1df146756 | 228 | #define ADC_Channel_6 ((uint8_t)0x06) |
mbed_official | 76:aeb1df146756 | 229 | #define ADC_Channel_7 ((uint8_t)0x07) |
mbed_official | 76:aeb1df146756 | 230 | #define ADC_Channel_8 ((uint8_t)0x08) |
mbed_official | 76:aeb1df146756 | 231 | #define ADC_Channel_9 ((uint8_t)0x09) |
mbed_official | 76:aeb1df146756 | 232 | #define ADC_Channel_10 ((uint8_t)0x0A) |
mbed_official | 76:aeb1df146756 | 233 | #define ADC_Channel_11 ((uint8_t)0x0B) |
mbed_official | 76:aeb1df146756 | 234 | #define ADC_Channel_12 ((uint8_t)0x0C) |
mbed_official | 76:aeb1df146756 | 235 | |
mbed_official | 76:aeb1df146756 | 236 | |
mbed_official | 76:aeb1df146756 | 237 | /* ADC Bank B Channels -------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 238 | #define ADC_Channel_0b ADC_Channel_0 |
mbed_official | 76:aeb1df146756 | 239 | #define ADC_Channel_1b ADC_Channel_1 |
mbed_official | 76:aeb1df146756 | 240 | #define ADC_Channel_2b ADC_Channel_2 |
mbed_official | 76:aeb1df146756 | 241 | #define ADC_Channel_3b ADC_Channel_3 |
mbed_official | 76:aeb1df146756 | 242 | |
mbed_official | 76:aeb1df146756 | 243 | #define ADC_Channel_6b ADC_Channel_6 |
mbed_official | 76:aeb1df146756 | 244 | #define ADC_Channel_7b ADC_Channel_7 |
mbed_official | 76:aeb1df146756 | 245 | #define ADC_Channel_8b ADC_Channel_8 |
mbed_official | 76:aeb1df146756 | 246 | #define ADC_Channel_9b ADC_Channel_9 |
mbed_official | 76:aeb1df146756 | 247 | #define ADC_Channel_10b ADC_Channel_10 |
mbed_official | 76:aeb1df146756 | 248 | #define ADC_Channel_11b ADC_Channel_11 |
mbed_official | 76:aeb1df146756 | 249 | #define ADC_Channel_12b ADC_Channel_12 |
mbed_official | 76:aeb1df146756 | 250 | |
mbed_official | 76:aeb1df146756 | 251 | /* ADC Common Channels (ADC Bank A and B) ------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 252 | #define ADC_Channel_4 ((uint8_t)0x04) |
mbed_official | 76:aeb1df146756 | 253 | #define ADC_Channel_5 ((uint8_t)0x05) |
mbed_official | 76:aeb1df146756 | 254 | |
mbed_official | 76:aeb1df146756 | 255 | #define ADC_Channel_13 ((uint8_t)0x0D) |
mbed_official | 76:aeb1df146756 | 256 | #define ADC_Channel_14 ((uint8_t)0x0E) |
mbed_official | 76:aeb1df146756 | 257 | #define ADC_Channel_15 ((uint8_t)0x0F) |
mbed_official | 76:aeb1df146756 | 258 | #define ADC_Channel_16 ((uint8_t)0x10) |
mbed_official | 76:aeb1df146756 | 259 | #define ADC_Channel_17 ((uint8_t)0x11) |
mbed_official | 76:aeb1df146756 | 260 | #define ADC_Channel_18 ((uint8_t)0x12) |
mbed_official | 76:aeb1df146756 | 261 | #define ADC_Channel_19 ((uint8_t)0x13) |
mbed_official | 76:aeb1df146756 | 262 | #define ADC_Channel_20 ((uint8_t)0x14) |
mbed_official | 76:aeb1df146756 | 263 | #define ADC_Channel_21 ((uint8_t)0x15) |
mbed_official | 76:aeb1df146756 | 264 | #define ADC_Channel_22 ((uint8_t)0x16) |
mbed_official | 76:aeb1df146756 | 265 | #define ADC_Channel_23 ((uint8_t)0x17) |
mbed_official | 76:aeb1df146756 | 266 | #define ADC_Channel_24 ((uint8_t)0x18) |
mbed_official | 76:aeb1df146756 | 267 | #define ADC_Channel_25 ((uint8_t)0x19) |
mbed_official | 76:aeb1df146756 | 268 | |
mbed_official | 76:aeb1df146756 | 269 | #define ADC_Channel_27 ((uint8_t)0x1B) |
mbed_official | 76:aeb1df146756 | 270 | #define ADC_Channel_28 ((uint8_t)0x1C) |
mbed_official | 76:aeb1df146756 | 271 | #define ADC_Channel_29 ((uint8_t)0x1D) |
mbed_official | 76:aeb1df146756 | 272 | #define ADC_Channel_30 ((uint8_t)0x1E) |
mbed_official | 76:aeb1df146756 | 273 | #define ADC_Channel_31 ((uint8_t)0x1F) |
mbed_official | 76:aeb1df146756 | 274 | |
mbed_official | 76:aeb1df146756 | 275 | #define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16) |
mbed_official | 76:aeb1df146756 | 276 | #define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17) |
mbed_official | 76:aeb1df146756 | 277 | |
mbed_official | 76:aeb1df146756 | 278 | #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_0) || ((CHANNEL) == ADC_Channel_1) || \ |
mbed_official | 76:aeb1df146756 | 279 | ((CHANNEL) == ADC_Channel_2) || ((CHANNEL) == ADC_Channel_3) || \ |
mbed_official | 76:aeb1df146756 | 280 | ((CHANNEL) == ADC_Channel_4) || ((CHANNEL) == ADC_Channel_5) || \ |
mbed_official | 76:aeb1df146756 | 281 | ((CHANNEL) == ADC_Channel_6) || ((CHANNEL) == ADC_Channel_7) || \ |
mbed_official | 76:aeb1df146756 | 282 | ((CHANNEL) == ADC_Channel_8) || ((CHANNEL) == ADC_Channel_9) || \ |
mbed_official | 76:aeb1df146756 | 283 | ((CHANNEL) == ADC_Channel_10) || ((CHANNEL) == ADC_Channel_11) || \ |
mbed_official | 76:aeb1df146756 | 284 | ((CHANNEL) == ADC_Channel_12) || ((CHANNEL) == ADC_Channel_13) || \ |
mbed_official | 76:aeb1df146756 | 285 | ((CHANNEL) == ADC_Channel_14) || ((CHANNEL) == ADC_Channel_15) || \ |
mbed_official | 76:aeb1df146756 | 286 | ((CHANNEL) == ADC_Channel_16) || ((CHANNEL) == ADC_Channel_17) || \ |
mbed_official | 76:aeb1df146756 | 287 | ((CHANNEL) == ADC_Channel_18) || ((CHANNEL) == ADC_Channel_19) || \ |
mbed_official | 76:aeb1df146756 | 288 | ((CHANNEL) == ADC_Channel_20) || ((CHANNEL) == ADC_Channel_21) || \ |
mbed_official | 76:aeb1df146756 | 289 | ((CHANNEL) == ADC_Channel_22) || ((CHANNEL) == ADC_Channel_23) || \ |
mbed_official | 76:aeb1df146756 | 290 | ((CHANNEL) == ADC_Channel_24) || ((CHANNEL) == ADC_Channel_25) || \ |
mbed_official | 76:aeb1df146756 | 291 | ((CHANNEL) == ADC_Channel_27) || ((CHANNEL) == ADC_Channel_28) || \ |
mbed_official | 76:aeb1df146756 | 292 | ((CHANNEL) == ADC_Channel_29) || ((CHANNEL) == ADC_Channel_30) || \ |
mbed_official | 76:aeb1df146756 | 293 | ((CHANNEL) == ADC_Channel_31)) |
mbed_official | 76:aeb1df146756 | 294 | /** |
mbed_official | 76:aeb1df146756 | 295 | * @} |
mbed_official | 76:aeb1df146756 | 296 | */ |
mbed_official | 76:aeb1df146756 | 297 | |
mbed_official | 76:aeb1df146756 | 298 | /** @defgroup ADC_sampling_times |
mbed_official | 76:aeb1df146756 | 299 | * @{ |
mbed_official | 76:aeb1df146756 | 300 | */ |
mbed_official | 76:aeb1df146756 | 301 | |
mbed_official | 76:aeb1df146756 | 302 | #define ADC_SampleTime_4Cycles ((uint8_t)0x00) |
mbed_official | 76:aeb1df146756 | 303 | #define ADC_SampleTime_9Cycles ((uint8_t)0x01) |
mbed_official | 76:aeb1df146756 | 304 | #define ADC_SampleTime_16Cycles ((uint8_t)0x02) |
mbed_official | 76:aeb1df146756 | 305 | #define ADC_SampleTime_24Cycles ((uint8_t)0x03) |
mbed_official | 76:aeb1df146756 | 306 | #define ADC_SampleTime_48Cycles ((uint8_t)0x04) |
mbed_official | 76:aeb1df146756 | 307 | #define ADC_SampleTime_96Cycles ((uint8_t)0x05) |
mbed_official | 76:aeb1df146756 | 308 | #define ADC_SampleTime_192Cycles ((uint8_t)0x06) |
mbed_official | 76:aeb1df146756 | 309 | #define ADC_SampleTime_384Cycles ((uint8_t)0x07) |
mbed_official | 76:aeb1df146756 | 310 | |
mbed_official | 76:aeb1df146756 | 311 | #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_4Cycles) || \ |
mbed_official | 76:aeb1df146756 | 312 | ((TIME) == ADC_SampleTime_9Cycles) || \ |
mbed_official | 76:aeb1df146756 | 313 | ((TIME) == ADC_SampleTime_16Cycles) || \ |
mbed_official | 76:aeb1df146756 | 314 | ((TIME) == ADC_SampleTime_24Cycles) || \ |
mbed_official | 76:aeb1df146756 | 315 | ((TIME) == ADC_SampleTime_48Cycles) || \ |
mbed_official | 76:aeb1df146756 | 316 | ((TIME) == ADC_SampleTime_96Cycles) || \ |
mbed_official | 76:aeb1df146756 | 317 | ((TIME) == ADC_SampleTime_192Cycles) || \ |
mbed_official | 76:aeb1df146756 | 318 | ((TIME) == ADC_SampleTime_384Cycles)) |
mbed_official | 76:aeb1df146756 | 319 | /** |
mbed_official | 76:aeb1df146756 | 320 | * @} |
mbed_official | 76:aeb1df146756 | 321 | */ |
mbed_official | 76:aeb1df146756 | 322 | |
mbed_official | 76:aeb1df146756 | 323 | /** @defgroup ADC_Delay_length |
mbed_official | 76:aeb1df146756 | 324 | * @{ |
mbed_official | 76:aeb1df146756 | 325 | */ |
mbed_official | 76:aeb1df146756 | 326 | |
mbed_official | 76:aeb1df146756 | 327 | #define ADC_DelayLength_None ((uint8_t)0x00) |
mbed_official | 76:aeb1df146756 | 328 | #define ADC_DelayLength_Freeze ((uint8_t)0x10) |
mbed_official | 76:aeb1df146756 | 329 | #define ADC_DelayLength_7Cycles ((uint8_t)0x20) |
mbed_official | 76:aeb1df146756 | 330 | #define ADC_DelayLength_15Cycles ((uint8_t)0x30) |
mbed_official | 76:aeb1df146756 | 331 | #define ADC_DelayLength_31Cycles ((uint8_t)0x40) |
mbed_official | 76:aeb1df146756 | 332 | #define ADC_DelayLength_63Cycles ((uint8_t)0x50) |
mbed_official | 76:aeb1df146756 | 333 | #define ADC_DelayLength_127Cycles ((uint8_t)0x60) |
mbed_official | 76:aeb1df146756 | 334 | #define ADC_DelayLength_255Cycles ((uint8_t)0x70) |
mbed_official | 76:aeb1df146756 | 335 | |
mbed_official | 76:aeb1df146756 | 336 | #define IS_ADC_DELAY_LENGTH(LENGTH) (((LENGTH) == ADC_DelayLength_None) || \ |
mbed_official | 76:aeb1df146756 | 337 | ((LENGTH) == ADC_DelayLength_Freeze) || \ |
mbed_official | 76:aeb1df146756 | 338 | ((LENGTH) == ADC_DelayLength_7Cycles) || \ |
mbed_official | 76:aeb1df146756 | 339 | ((LENGTH) == ADC_DelayLength_15Cycles) || \ |
mbed_official | 76:aeb1df146756 | 340 | ((LENGTH) == ADC_DelayLength_31Cycles) || \ |
mbed_official | 76:aeb1df146756 | 341 | ((LENGTH) == ADC_DelayLength_63Cycles) || \ |
mbed_official | 76:aeb1df146756 | 342 | ((LENGTH) == ADC_DelayLength_127Cycles) || \ |
mbed_official | 76:aeb1df146756 | 343 | ((LENGTH) == ADC_DelayLength_255Cycles)) |
mbed_official | 76:aeb1df146756 | 344 | |
mbed_official | 76:aeb1df146756 | 345 | /** |
mbed_official | 76:aeb1df146756 | 346 | * @} |
mbed_official | 76:aeb1df146756 | 347 | */ |
mbed_official | 76:aeb1df146756 | 348 | |
mbed_official | 76:aeb1df146756 | 349 | /** @defgroup ADC_external_trigger_edge_for_injected_channels_conversion |
mbed_official | 76:aeb1df146756 | 350 | * @{ |
mbed_official | 76:aeb1df146756 | 351 | */ |
mbed_official | 76:aeb1df146756 | 352 | #define ADC_ExternalTrigInjecConvEdge_None ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 353 | #define ADC_ExternalTrigInjecConvEdge_Rising ((uint32_t)0x00100000) |
mbed_official | 76:aeb1df146756 | 354 | #define ADC_ExternalTrigInjecConvEdge_Falling ((uint32_t)0x00200000) |
mbed_official | 76:aeb1df146756 | 355 | #define ADC_ExternalTrigInjecConvEdge_RisingFalling ((uint32_t)0x00300000) |
mbed_official | 76:aeb1df146756 | 356 | |
mbed_official | 76:aeb1df146756 | 357 | #define IS_ADC_EXT_INJEC_TRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigInjecConvEdge_None) || \ |
mbed_official | 76:aeb1df146756 | 358 | ((EDGE) == ADC_ExternalTrigInjecConvEdge_Rising) || \ |
mbed_official | 76:aeb1df146756 | 359 | ((EDGE) == ADC_ExternalTrigInjecConvEdge_Falling) || \ |
mbed_official | 76:aeb1df146756 | 360 | ((EDGE) == ADC_ExternalTrigInjecConvEdge_RisingFalling)) |
mbed_official | 76:aeb1df146756 | 361 | /** |
mbed_official | 76:aeb1df146756 | 362 | * @} |
mbed_official | 76:aeb1df146756 | 363 | */ |
mbed_official | 76:aeb1df146756 | 364 | |
mbed_official | 76:aeb1df146756 | 365 | |
mbed_official | 76:aeb1df146756 | 366 | /** @defgroup ADC_external_trigger_sources_for_injected_channels_conversion |
mbed_official | 76:aeb1df146756 | 367 | * @{ |
mbed_official | 76:aeb1df146756 | 368 | */ |
mbed_official | 76:aeb1df146756 | 369 | |
mbed_official | 76:aeb1df146756 | 370 | |
mbed_official | 76:aeb1df146756 | 371 | /* TIM2 */ |
mbed_official | 76:aeb1df146756 | 372 | #define ADC_ExternalTrigInjecConv_T2_TRGO ((uint32_t)0x00020000) |
mbed_official | 76:aeb1df146756 | 373 | #define ADC_ExternalTrigInjecConv_T2_CC1 ((uint32_t)0x00030000) |
mbed_official | 76:aeb1df146756 | 374 | |
mbed_official | 76:aeb1df146756 | 375 | /* TIM3 */ |
mbed_official | 76:aeb1df146756 | 376 | #define ADC_ExternalTrigInjecConv_T3_CC4 ((uint32_t)0x00040000) |
mbed_official | 76:aeb1df146756 | 377 | |
mbed_official | 76:aeb1df146756 | 378 | /* TIM4 */ |
mbed_official | 76:aeb1df146756 | 379 | #define ADC_ExternalTrigInjecConv_T4_TRGO ((uint32_t)0x00050000) |
mbed_official | 76:aeb1df146756 | 380 | #define ADC_ExternalTrigInjecConv_T4_CC1 ((uint32_t)0x00060000) |
mbed_official | 76:aeb1df146756 | 381 | #define ADC_ExternalTrigInjecConv_T4_CC2 ((uint32_t)0x00070000) |
mbed_official | 76:aeb1df146756 | 382 | #define ADC_ExternalTrigInjecConv_T4_CC3 ((uint32_t)0x00080000) |
mbed_official | 76:aeb1df146756 | 383 | |
mbed_official | 76:aeb1df146756 | 384 | /* TIM7 */ |
mbed_official | 76:aeb1df146756 | 385 | #define ADC_ExternalTrigInjecConv_T7_TRGO ((uint32_t)0x000A0000) |
mbed_official | 76:aeb1df146756 | 386 | |
mbed_official | 76:aeb1df146756 | 387 | /* TIM9 */ |
mbed_official | 76:aeb1df146756 | 388 | #define ADC_ExternalTrigInjecConv_T9_CC1 ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 389 | #define ADC_ExternalTrigInjecConv_T9_TRGO ((uint32_t)0x00010000) |
mbed_official | 76:aeb1df146756 | 390 | |
mbed_official | 76:aeb1df146756 | 391 | /* TIM10 */ |
mbed_official | 76:aeb1df146756 | 392 | #define ADC_ExternalTrigInjecConv_T10_CC1 ((uint32_t)0x00090000) |
mbed_official | 76:aeb1df146756 | 393 | |
mbed_official | 76:aeb1df146756 | 394 | /* EXTI */ |
mbed_official | 76:aeb1df146756 | 395 | #define ADC_ExternalTrigInjecConv_Ext_IT15 ((uint32_t)0x000F0000) |
mbed_official | 76:aeb1df146756 | 396 | |
mbed_official | 76:aeb1df146756 | 397 | #define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_ExternalTrigInjecConv_T9_CC1) || \ |
mbed_official | 76:aeb1df146756 | 398 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T9_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 399 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T2_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 400 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T2_CC1) || \ |
mbed_official | 76:aeb1df146756 | 401 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T3_CC4) || \ |
mbed_official | 76:aeb1df146756 | 402 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 403 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC1) || \ |
mbed_official | 76:aeb1df146756 | 404 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC2) || \ |
mbed_official | 76:aeb1df146756 | 405 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC3) || \ |
mbed_official | 76:aeb1df146756 | 406 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T10_CC1) || \ |
mbed_official | 76:aeb1df146756 | 407 | ((INJTRIG) == ADC_ExternalTrigInjecConv_T7_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 408 | ((INJTRIG) == ADC_ExternalTrigInjecConv_Ext_IT15)) |
mbed_official | 76:aeb1df146756 | 409 | /** |
mbed_official | 76:aeb1df146756 | 410 | * @} |
mbed_official | 76:aeb1df146756 | 411 | */ |
mbed_official | 76:aeb1df146756 | 412 | |
mbed_official | 76:aeb1df146756 | 413 | /** @defgroup ADC_injected_channel_selection |
mbed_official | 76:aeb1df146756 | 414 | * @{ |
mbed_official | 76:aeb1df146756 | 415 | */ |
mbed_official | 76:aeb1df146756 | 416 | #define ADC_InjectedChannel_1 ((uint8_t)0x18) |
mbed_official | 76:aeb1df146756 | 417 | #define ADC_InjectedChannel_2 ((uint8_t)0x1C) |
mbed_official | 76:aeb1df146756 | 418 | #define ADC_InjectedChannel_3 ((uint8_t)0x20) |
mbed_official | 76:aeb1df146756 | 419 | #define ADC_InjectedChannel_4 ((uint8_t)0x24) |
mbed_official | 76:aeb1df146756 | 420 | |
mbed_official | 76:aeb1df146756 | 421 | #define IS_ADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) == ADC_InjectedChannel_1) || \ |
mbed_official | 76:aeb1df146756 | 422 | ((CHANNEL) == ADC_InjectedChannel_2) || \ |
mbed_official | 76:aeb1df146756 | 423 | ((CHANNEL) == ADC_InjectedChannel_3) || \ |
mbed_official | 76:aeb1df146756 | 424 | ((CHANNEL) == ADC_InjectedChannel_4)) |
mbed_official | 76:aeb1df146756 | 425 | /** |
mbed_official | 76:aeb1df146756 | 426 | * @} |
mbed_official | 76:aeb1df146756 | 427 | */ |
mbed_official | 76:aeb1df146756 | 428 | |
mbed_official | 76:aeb1df146756 | 429 | /** @defgroup ADC_analog_watchdog_selection |
mbed_official | 76:aeb1df146756 | 430 | * @{ |
mbed_official | 76:aeb1df146756 | 431 | */ |
mbed_official | 76:aeb1df146756 | 432 | |
mbed_official | 76:aeb1df146756 | 433 | #define ADC_AnalogWatchdog_SingleRegEnable ((uint32_t)0x00800200) |
mbed_official | 76:aeb1df146756 | 434 | #define ADC_AnalogWatchdog_SingleInjecEnable ((uint32_t)0x00400200) |
mbed_official | 76:aeb1df146756 | 435 | #define ADC_AnalogWatchdog_SingleRegOrInjecEnable ((uint32_t)0x00C00200) |
mbed_official | 76:aeb1df146756 | 436 | #define ADC_AnalogWatchdog_AllRegEnable ((uint32_t)0x00800000) |
mbed_official | 76:aeb1df146756 | 437 | #define ADC_AnalogWatchdog_AllInjecEnable ((uint32_t)0x00400000) |
mbed_official | 76:aeb1df146756 | 438 | #define ADC_AnalogWatchdog_AllRegAllInjecEnable ((uint32_t)0x00C00000) |
mbed_official | 76:aeb1df146756 | 439 | #define ADC_AnalogWatchdog_None ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 440 | |
mbed_official | 76:aeb1df146756 | 441 | #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_AnalogWatchdog_SingleRegEnable) || \ |
mbed_official | 76:aeb1df146756 | 442 | ((WATCHDOG) == ADC_AnalogWatchdog_SingleInjecEnable) || \ |
mbed_official | 76:aeb1df146756 | 443 | ((WATCHDOG) == ADC_AnalogWatchdog_SingleRegOrInjecEnable) || \ |
mbed_official | 76:aeb1df146756 | 444 | ((WATCHDOG) == ADC_AnalogWatchdog_AllRegEnable) || \ |
mbed_official | 76:aeb1df146756 | 445 | ((WATCHDOG) == ADC_AnalogWatchdog_AllInjecEnable) || \ |
mbed_official | 76:aeb1df146756 | 446 | ((WATCHDOG) == ADC_AnalogWatchdog_AllRegAllInjecEnable) || \ |
mbed_official | 76:aeb1df146756 | 447 | ((WATCHDOG) == ADC_AnalogWatchdog_None)) |
mbed_official | 76:aeb1df146756 | 448 | /** |
mbed_official | 76:aeb1df146756 | 449 | * @} |
mbed_official | 76:aeb1df146756 | 450 | */ |
mbed_official | 76:aeb1df146756 | 451 | |
mbed_official | 76:aeb1df146756 | 452 | /** @defgroup ADC_interrupts_definition |
mbed_official | 76:aeb1df146756 | 453 | * @{ |
mbed_official | 76:aeb1df146756 | 454 | */ |
mbed_official | 76:aeb1df146756 | 455 | |
mbed_official | 76:aeb1df146756 | 456 | #define ADC_IT_AWD ((uint16_t)0x0106) |
mbed_official | 76:aeb1df146756 | 457 | #define ADC_IT_EOC ((uint16_t)0x0205) |
mbed_official | 76:aeb1df146756 | 458 | #define ADC_IT_JEOC ((uint16_t)0x0407) |
mbed_official | 76:aeb1df146756 | 459 | #define ADC_IT_OVR ((uint16_t)0x201A) |
mbed_official | 76:aeb1df146756 | 460 | |
mbed_official | 76:aeb1df146756 | 461 | #define IS_ADC_IT(IT) (((IT) == ADC_IT_AWD) || ((IT) == ADC_IT_EOC) || \ |
mbed_official | 76:aeb1df146756 | 462 | ((IT) == ADC_IT_JEOC)|| ((IT) == ADC_IT_OVR)) |
mbed_official | 76:aeb1df146756 | 463 | /** |
mbed_official | 76:aeb1df146756 | 464 | * @} |
mbed_official | 76:aeb1df146756 | 465 | */ |
mbed_official | 76:aeb1df146756 | 466 | |
mbed_official | 76:aeb1df146756 | 467 | /** @defgroup ADC_flags_definition |
mbed_official | 76:aeb1df146756 | 468 | * @{ |
mbed_official | 76:aeb1df146756 | 469 | */ |
mbed_official | 76:aeb1df146756 | 470 | |
mbed_official | 76:aeb1df146756 | 471 | #define ADC_FLAG_AWD ((uint16_t)0x0001) |
mbed_official | 76:aeb1df146756 | 472 | #define ADC_FLAG_EOC ((uint16_t)0x0002) |
mbed_official | 76:aeb1df146756 | 473 | #define ADC_FLAG_JEOC ((uint16_t)0x0004) |
mbed_official | 76:aeb1df146756 | 474 | #define ADC_FLAG_JSTRT ((uint16_t)0x0008) |
mbed_official | 76:aeb1df146756 | 475 | #define ADC_FLAG_STRT ((uint16_t)0x0010) |
mbed_official | 76:aeb1df146756 | 476 | #define ADC_FLAG_OVR ((uint16_t)0x0020) |
mbed_official | 76:aeb1df146756 | 477 | #define ADC_FLAG_ADONS ((uint16_t)0x0040) |
mbed_official | 76:aeb1df146756 | 478 | #define ADC_FLAG_RCNR ((uint16_t)0x0100) |
mbed_official | 76:aeb1df146756 | 479 | #define ADC_FLAG_JCNR ((uint16_t)0x0200) |
mbed_official | 76:aeb1df146756 | 480 | |
mbed_official | 76:aeb1df146756 | 481 | #define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFC0) == 0x00) && ((FLAG) != 0x00)) |
mbed_official | 76:aeb1df146756 | 482 | |
mbed_official | 76:aeb1df146756 | 483 | #define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || ((FLAG) == ADC_FLAG_EOC) || \ |
mbed_official | 76:aeb1df146756 | 484 | ((FLAG) == ADC_FLAG_JEOC) || ((FLAG)== ADC_FLAG_JSTRT) || \ |
mbed_official | 76:aeb1df146756 | 485 | ((FLAG) == ADC_FLAG_STRT) || ((FLAG)== ADC_FLAG_OVR) || \ |
mbed_official | 76:aeb1df146756 | 486 | ((FLAG) == ADC_FLAG_ADONS) || ((FLAG)== ADC_FLAG_RCNR) || \ |
mbed_official | 76:aeb1df146756 | 487 | ((FLAG) == ADC_FLAG_JCNR)) |
mbed_official | 76:aeb1df146756 | 488 | /** |
mbed_official | 76:aeb1df146756 | 489 | * @} |
mbed_official | 76:aeb1df146756 | 490 | */ |
mbed_official | 76:aeb1df146756 | 491 | |
mbed_official | 76:aeb1df146756 | 492 | /** @defgroup ADC_thresholds |
mbed_official | 76:aeb1df146756 | 493 | * @{ |
mbed_official | 76:aeb1df146756 | 494 | */ |
mbed_official | 76:aeb1df146756 | 495 | |
mbed_official | 76:aeb1df146756 | 496 | #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF) |
mbed_official | 76:aeb1df146756 | 497 | |
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_injected_offset |
mbed_official | 76:aeb1df146756 | 503 | * @{ |
mbed_official | 76:aeb1df146756 | 504 | */ |
mbed_official | 76:aeb1df146756 | 505 | |
mbed_official | 76:aeb1df146756 | 506 | #define IS_ADC_OFFSET(OFFSET) ((OFFSET) <= 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_length |
mbed_official | 76:aeb1df146756 | 513 | * @{ |
mbed_official | 76:aeb1df146756 | 514 | */ |
mbed_official | 76:aeb1df146756 | 515 | |
mbed_official | 76:aeb1df146756 | 516 | #define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4)) |
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_rank |
mbed_official | 76:aeb1df146756 | 523 | * @{ |
mbed_official | 76:aeb1df146756 | 524 | */ |
mbed_official | 76:aeb1df146756 | 525 | |
mbed_official | 76:aeb1df146756 | 526 | #define IS_ADC_INJECTED_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 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_regular_length |
mbed_official | 76:aeb1df146756 | 533 | * @{ |
mbed_official | 76:aeb1df146756 | 534 | */ |
mbed_official | 76:aeb1df146756 | 535 | |
mbed_official | 76:aeb1df146756 | 536 | #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 1) && ((LENGTH) <= 28)) |
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_rank |
mbed_official | 76:aeb1df146756 | 543 | * @{ |
mbed_official | 76:aeb1df146756 | 544 | */ |
mbed_official | 76:aeb1df146756 | 545 | |
mbed_official | 76:aeb1df146756 | 546 | #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= 1) && ((RANK) <= 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_discontinuous_mode_number |
mbed_official | 76:aeb1df146756 | 553 | * @{ |
mbed_official | 76:aeb1df146756 | 554 | */ |
mbed_official | 76:aeb1df146756 | 555 | |
mbed_official | 76:aeb1df146756 | 556 | #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8)) |
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_Bank_Selection |
mbed_official | 76:aeb1df146756 | 563 | * @{ |
mbed_official | 76:aeb1df146756 | 564 | */ |
mbed_official | 76:aeb1df146756 | 565 | #define ADC_Bank_A ((uint8_t)0x00) |
mbed_official | 76:aeb1df146756 | 566 | #define ADC_Bank_B ((uint8_t)0x01) |
mbed_official | 76:aeb1df146756 | 567 | #define IS_ADC_BANK(BANK) (((BANK) == ADC_Bank_A) || ((BANK) == ADC_Bank_B)) |
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 | |
mbed_official | 76:aeb1df146756 | 573 | /** |
mbed_official | 76:aeb1df146756 | 574 | * @} |
mbed_official | 76:aeb1df146756 | 575 | */ |
mbed_official | 76:aeb1df146756 | 576 | |
mbed_official | 76:aeb1df146756 | 577 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 578 | /* Exported functions ------------------------------------------------------- */ |
mbed_official | 76:aeb1df146756 | 579 | |
mbed_official | 76:aeb1df146756 | 580 | /* Function used to set the ADC configuration to the default reset state *****/ |
mbed_official | 76:aeb1df146756 | 581 | void ADC_DeInit(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 582 | |
mbed_official | 76:aeb1df146756 | 583 | /* Initialization and Configuration functions *********************************/ |
mbed_official | 76:aeb1df146756 | 584 | void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct); |
mbed_official | 76:aeb1df146756 | 585 | void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct); |
mbed_official | 76:aeb1df146756 | 586 | void ADC_CommonInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct); |
mbed_official | 76:aeb1df146756 | 587 | void ADC_CommonStructInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct); |
mbed_official | 76:aeb1df146756 | 588 | void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 589 | void ADC_BankSelection(ADC_TypeDef* ADCx, uint8_t ADC_Bank); |
mbed_official | 76:aeb1df146756 | 590 | |
mbed_official | 76:aeb1df146756 | 591 | /* Power saving functions *****************************************************/ |
mbed_official | 76:aeb1df146756 | 592 | void ADC_PowerDownCmd(ADC_TypeDef* ADCx, uint32_t ADC_PowerDown, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 593 | void ADC_DelaySelectionConfig(ADC_TypeDef* ADCx, uint8_t ADC_DelayLength); |
mbed_official | 76:aeb1df146756 | 594 | |
mbed_official | 76:aeb1df146756 | 595 | /* Analog Watchdog configuration functions ************************************/ |
mbed_official | 76:aeb1df146756 | 596 | void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog); |
mbed_official | 76:aeb1df146756 | 597 | void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold,uint16_t LowThreshold); |
mbed_official | 76:aeb1df146756 | 598 | void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel); |
mbed_official | 76:aeb1df146756 | 599 | |
mbed_official | 76:aeb1df146756 | 600 | /* Temperature Sensor & Vrefint (Voltage Reference internal) management function */ |
mbed_official | 76:aeb1df146756 | 601 | void ADC_TempSensorVrefintCmd(FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 602 | |
mbed_official | 76:aeb1df146756 | 603 | /* Regular Channels Configuration functions ***********************************/ |
mbed_official | 76:aeb1df146756 | 604 | void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime); |
mbed_official | 76:aeb1df146756 | 605 | void ADC_SoftwareStartConv(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 606 | FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 607 | void ADC_EOCOnEachRegularChannelCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 608 | void ADC_ContinuousModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 609 | void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, uint8_t Number); |
mbed_official | 76:aeb1df146756 | 610 | void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 611 | uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 612 | |
mbed_official | 76:aeb1df146756 | 613 | /* Regular Channels DMA Configuration functions *******************************/ |
mbed_official | 76:aeb1df146756 | 614 | void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 615 | void ADC_DMARequestAfterLastTransferCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 616 | |
mbed_official | 76:aeb1df146756 | 617 | /* Injected channels Configuration functions **********************************/ |
mbed_official | 76:aeb1df146756 | 618 | void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime); |
mbed_official | 76:aeb1df146756 | 619 | void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length); |
mbed_official | 76:aeb1df146756 | 620 | void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset); |
mbed_official | 76:aeb1df146756 | 621 | void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConv); |
mbed_official | 76:aeb1df146756 | 622 | void ADC_ExternalTrigInjectedConvEdgeConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConvEdge); |
mbed_official | 76:aeb1df146756 | 623 | void ADC_SoftwareStartInjectedConv(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 624 | FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx); |
mbed_official | 76:aeb1df146756 | 625 | void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 626 | void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 627 | uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel); |
mbed_official | 76:aeb1df146756 | 628 | |
mbed_official | 76:aeb1df146756 | 629 | /* Interrupts and flags management functions **********************************/ |
mbed_official | 76:aeb1df146756 | 630 | void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 631 | FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint16_t ADC_FLAG); |
mbed_official | 76:aeb1df146756 | 632 | void ADC_ClearFlag(ADC_TypeDef* ADCx, uint16_t ADC_FLAG); |
mbed_official | 76:aeb1df146756 | 633 | ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint16_t ADC_IT); |
mbed_official | 76:aeb1df146756 | 634 | void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint16_t ADC_IT); |
mbed_official | 76:aeb1df146756 | 635 | |
mbed_official | 76:aeb1df146756 | 636 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 637 | } |
mbed_official | 76:aeb1df146756 | 638 | #endif |
mbed_official | 76:aeb1df146756 | 639 | |
mbed_official | 76:aeb1df146756 | 640 | #endif /*__STM32L1xx_ADC_H */ |
mbed_official | 76:aeb1df146756 | 641 | |
mbed_official | 76:aeb1df146756 | 642 | /** |
mbed_official | 76:aeb1df146756 | 643 | * @} |
mbed_official | 76:aeb1df146756 | 644 | */ |
mbed_official | 76:aeb1df146756 | 645 | |
mbed_official | 76:aeb1df146756 | 646 | /** |
mbed_official | 76:aeb1df146756 | 647 | * @} |
mbed_official | 76:aeb1df146756 | 648 | */ |
mbed_official | 76:aeb1df146756 | 649 | |
mbed_official | 76:aeb1df146756 | 650 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |