Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_NUCLEO_F303K8/stm32f3xx_hal_adc.h@109:9296ab0bfc11, 2015-10-29 (annotated)
- Committer:
- Kojto
- Date:
- Thu Oct 29 08:40:18 2015 +0000
- Revision:
- 109:9296ab0bfc11
- Child:
- 122:f9eeca106725
Release 109 of the mbed library
Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Kojto | 109:9296ab0bfc11 | 1 | /** |
| Kojto | 109:9296ab0bfc11 | 2 | ****************************************************************************** |
| Kojto | 109:9296ab0bfc11 | 3 | * @file stm32f3xx_hal_adc.h |
| Kojto | 109:9296ab0bfc11 | 4 | * @author MCD Application Team |
| Kojto | 109:9296ab0bfc11 | 5 | * @version V1.1.0 |
| Kojto | 109:9296ab0bfc11 | 6 | * @date 12-Sept-2014 |
| Kojto | 109:9296ab0bfc11 | 7 | * @brief Header file containing functions prototypes of ADC HAL library. |
| Kojto | 109:9296ab0bfc11 | 8 | ****************************************************************************** |
| Kojto | 109:9296ab0bfc11 | 9 | * @attention |
| Kojto | 109:9296ab0bfc11 | 10 | * |
| Kojto | 109:9296ab0bfc11 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
| Kojto | 109:9296ab0bfc11 | 12 | * |
| Kojto | 109:9296ab0bfc11 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
| Kojto | 109:9296ab0bfc11 | 14 | * are permitted provided that the following conditions are met: |
| Kojto | 109:9296ab0bfc11 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
| Kojto | 109:9296ab0bfc11 | 16 | * this list of conditions and the following disclaimer. |
| Kojto | 109:9296ab0bfc11 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| Kojto | 109:9296ab0bfc11 | 18 | * this list of conditions and the following disclaimer in the documentation |
| Kojto | 109:9296ab0bfc11 | 19 | * and/or other materials provided with the distribution. |
| Kojto | 109:9296ab0bfc11 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| Kojto | 109:9296ab0bfc11 | 21 | * may be used to endorse or promote products derived from this software |
| Kojto | 109:9296ab0bfc11 | 22 | * without specific prior written permission. |
| Kojto | 109:9296ab0bfc11 | 23 | * |
| Kojto | 109:9296ab0bfc11 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| Kojto | 109:9296ab0bfc11 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| Kojto | 109:9296ab0bfc11 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| Kojto | 109:9296ab0bfc11 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| Kojto | 109:9296ab0bfc11 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| Kojto | 109:9296ab0bfc11 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| Kojto | 109:9296ab0bfc11 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| Kojto | 109:9296ab0bfc11 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| Kojto | 109:9296ab0bfc11 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| Kojto | 109:9296ab0bfc11 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Kojto | 109:9296ab0bfc11 | 34 | * |
| Kojto | 109:9296ab0bfc11 | 35 | ****************************************************************************** |
| Kojto | 109:9296ab0bfc11 | 36 | */ |
| Kojto | 109:9296ab0bfc11 | 37 | |
| Kojto | 109:9296ab0bfc11 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 39 | #ifndef __STM32F3xx_ADC_H |
| Kojto | 109:9296ab0bfc11 | 40 | #define __STM32F3xx_ADC_H |
| Kojto | 109:9296ab0bfc11 | 41 | |
| Kojto | 109:9296ab0bfc11 | 42 | #ifdef __cplusplus |
| Kojto | 109:9296ab0bfc11 | 43 | extern "C" { |
| Kojto | 109:9296ab0bfc11 | 44 | #endif |
| Kojto | 109:9296ab0bfc11 | 45 | |
| Kojto | 109:9296ab0bfc11 | 46 | /* Includes ------------------------------------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 47 | #include "stm32f3xx_hal_def.h" |
| Kojto | 109:9296ab0bfc11 | 48 | #include "stm32f3xx_hal_adc_ex.h" |
| Kojto | 109:9296ab0bfc11 | 49 | |
| Kojto | 109:9296ab0bfc11 | 50 | /** @addtogroup STM32F3xx_HAL_Driver |
| Kojto | 109:9296ab0bfc11 | 51 | * @{ |
| Kojto | 109:9296ab0bfc11 | 52 | */ |
| Kojto | 109:9296ab0bfc11 | 53 | |
| Kojto | 109:9296ab0bfc11 | 54 | /** @addtogroup ADC |
| Kojto | 109:9296ab0bfc11 | 55 | * @{ |
| Kojto | 109:9296ab0bfc11 | 56 | */ |
| Kojto | 109:9296ab0bfc11 | 57 | |
| Kojto | 109:9296ab0bfc11 | 58 | /* Exported types ------------------------------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 59 | /** @defgroup ADC_Exported_Types ADC Exported Types |
| Kojto | 109:9296ab0bfc11 | 60 | * @{ |
| Kojto | 109:9296ab0bfc11 | 61 | */ |
| Kojto | 109:9296ab0bfc11 | 62 | /** |
| Kojto | 109:9296ab0bfc11 | 63 | * @brief HAL ADC state machine: ADC States structure definition |
| Kojto | 109:9296ab0bfc11 | 64 | */ |
| Kojto | 109:9296ab0bfc11 | 65 | typedef enum |
| Kojto | 109:9296ab0bfc11 | 66 | { |
| Kojto | 109:9296ab0bfc11 | 67 | HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */ |
| Kojto | 109:9296ab0bfc11 | 68 | HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */ |
| Kojto | 109:9296ab0bfc11 | 69 | HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */ |
| Kojto | 109:9296ab0bfc11 | 70 | HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */ |
| Kojto | 109:9296ab0bfc11 | 71 | HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */ |
| Kojto | 109:9296ab0bfc11 | 72 | HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */ |
| Kojto | 109:9296ab0bfc11 | 73 | HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
| Kojto | 109:9296ab0bfc11 | 74 | HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */ |
| Kojto | 109:9296ab0bfc11 | 75 | HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */ |
| Kojto | 109:9296ab0bfc11 | 76 | HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */ |
| Kojto | 109:9296ab0bfc11 | 77 | HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */ |
| Kojto | 109:9296ab0bfc11 | 78 | HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */ |
| Kojto | 109:9296ab0bfc11 | 79 | HAL_ADC_STATE_AWD = 0x06, /*!< ADC state analog watchdog (main analog watchdog, present on all STM32 devices) */ |
| Kojto | 109:9296ab0bfc11 | 80 | HAL_ADC_STATE_AWD2 = 0x07, /*!< ADC state analog watchdog (additional analog watchdog, present only on STM32F3 devices) */ |
| Kojto | 109:9296ab0bfc11 | 81 | HAL_ADC_STATE_AWD3 = 0x08, /*!< ADC state analog watchdog (additional analog watchdog, present only on STM32F3 devices) */ |
| Kojto | 109:9296ab0bfc11 | 82 | }HAL_ADC_StateTypeDef; |
| Kojto | 109:9296ab0bfc11 | 83 | |
| Kojto | 109:9296ab0bfc11 | 84 | /** |
| Kojto | 109:9296ab0bfc11 | 85 | * @brief ADC handle Structure definition |
| Kojto | 109:9296ab0bfc11 | 86 | */ |
| Kojto | 109:9296ab0bfc11 | 87 | typedef struct __ADC_HandleTypeDef |
| Kojto | 109:9296ab0bfc11 | 88 | { |
| Kojto | 109:9296ab0bfc11 | 89 | ADC_TypeDef *Instance; /*!< Register base address */ |
| Kojto | 109:9296ab0bfc11 | 90 | |
| Kojto | 109:9296ab0bfc11 | 91 | ADC_InitTypeDef Init; /*!< ADC required parameters */ |
| Kojto | 109:9296ab0bfc11 | 92 | |
| Kojto | 109:9296ab0bfc11 | 93 | __IO uint32_t NbrOfConversionRank ; /*!< ADC conversion rank counter */ |
| Kojto | 109:9296ab0bfc11 | 94 | |
| Kojto | 109:9296ab0bfc11 | 95 | DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */ |
| Kojto | 109:9296ab0bfc11 | 96 | |
| Kojto | 109:9296ab0bfc11 | 97 | HAL_LockTypeDef Lock; /*!< ADC locking object */ |
| Kojto | 109:9296ab0bfc11 | 98 | |
| Kojto | 109:9296ab0bfc11 | 99 | __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */ |
| Kojto | 109:9296ab0bfc11 | 100 | |
| Kojto | 109:9296ab0bfc11 | 101 | __IO uint32_t ErrorCode; /*!< ADC Error code */ |
| Kojto | 109:9296ab0bfc11 | 102 | }ADC_HandleTypeDef; |
| Kojto | 109:9296ab0bfc11 | 103 | /** |
| Kojto | 109:9296ab0bfc11 | 104 | * @} |
| Kojto | 109:9296ab0bfc11 | 105 | */ |
| Kojto | 109:9296ab0bfc11 | 106 | |
| Kojto | 109:9296ab0bfc11 | 107 | /* Exported constants --------------------------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 108 | /* Exported macros -----------------------------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 109 | |
| Kojto | 109:9296ab0bfc11 | 110 | /** @defgroup ADC_Exported_Macro ADC Exported Macros |
| Kojto | 109:9296ab0bfc11 | 111 | * @{ |
| Kojto | 109:9296ab0bfc11 | 112 | */ |
| Kojto | 109:9296ab0bfc11 | 113 | /** @brief Reset ADC handle state |
| Kojto | 109:9296ab0bfc11 | 114 | * @param __HANDLE__: ADC handle |
| Kojto | 109:9296ab0bfc11 | 115 | * @retval None |
| Kojto | 109:9296ab0bfc11 | 116 | */ |
| Kojto | 109:9296ab0bfc11 | 117 | #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET) |
| Kojto | 109:9296ab0bfc11 | 118 | |
| Kojto | 109:9296ab0bfc11 | 119 | /** |
| Kojto | 109:9296ab0bfc11 | 120 | * @} |
| Kojto | 109:9296ab0bfc11 | 121 | */ |
| Kojto | 109:9296ab0bfc11 | 122 | |
| Kojto | 109:9296ab0bfc11 | 123 | |
| Kojto | 109:9296ab0bfc11 | 124 | /* Include ADC HAL Extended module */ |
| Kojto | 109:9296ab0bfc11 | 125 | #include "stm32f3xx_hal_adc_ex.h" |
| Kojto | 109:9296ab0bfc11 | 126 | |
| Kojto | 109:9296ab0bfc11 | 127 | /* Exported functions --------------------------------------------------------*/ |
| Kojto | 109:9296ab0bfc11 | 128 | /** @addtogroup ADC_Exported_Functions ADC Exported Functions |
| Kojto | 109:9296ab0bfc11 | 129 | * @{ |
| Kojto | 109:9296ab0bfc11 | 130 | */ |
| Kojto | 109:9296ab0bfc11 | 131 | |
| Kojto | 109:9296ab0bfc11 | 132 | /** @addtogroup ADC_Exported_Functions_Group1 Initialization and de-initialization functions |
| Kojto | 109:9296ab0bfc11 | 133 | * @brief Initialization and Configuration functions |
| Kojto | 109:9296ab0bfc11 | 134 | * @{ |
| Kojto | 109:9296ab0bfc11 | 135 | */ |
| Kojto | 109:9296ab0bfc11 | 136 | /* Initialization and de-initialization functions **********************************/ |
| Kojto | 109:9296ab0bfc11 | 137 | HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 138 | HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc); |
| Kojto | 109:9296ab0bfc11 | 139 | void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 140 | void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 141 | /** |
| Kojto | 109:9296ab0bfc11 | 142 | * @} |
| Kojto | 109:9296ab0bfc11 | 143 | */ |
| Kojto | 109:9296ab0bfc11 | 144 | |
| Kojto | 109:9296ab0bfc11 | 145 | /** @addtogroup ADC_Exported_Functions_Group2 Input and Output operation functions |
| Kojto | 109:9296ab0bfc11 | 146 | * @brief IO operation functions |
| Kojto | 109:9296ab0bfc11 | 147 | * @{ |
| Kojto | 109:9296ab0bfc11 | 148 | */ |
| Kojto | 109:9296ab0bfc11 | 149 | /* Blocking mode: Polling */ |
| Kojto | 109:9296ab0bfc11 | 150 | HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 151 | HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 152 | HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout); |
| Kojto | 109:9296ab0bfc11 | 153 | HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout); |
| Kojto | 109:9296ab0bfc11 | 154 | |
| Kojto | 109:9296ab0bfc11 | 155 | /* Non-blocking mode: Interruption */ |
| Kojto | 109:9296ab0bfc11 | 156 | HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 157 | HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 158 | |
| Kojto | 109:9296ab0bfc11 | 159 | /* Non-blocking mode: DMA */ |
| Kojto | 109:9296ab0bfc11 | 160 | HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length); |
| Kojto | 109:9296ab0bfc11 | 161 | HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 162 | |
| Kojto | 109:9296ab0bfc11 | 163 | /* ADC retrieve conversion value intended to be used with polling or interruption */ |
| Kojto | 109:9296ab0bfc11 | 164 | uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 165 | |
| Kojto | 109:9296ab0bfc11 | 166 | /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */ |
| Kojto | 109:9296ab0bfc11 | 167 | void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 168 | void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 169 | void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 170 | void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 171 | void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc); |
| Kojto | 109:9296ab0bfc11 | 172 | /** |
| Kojto | 109:9296ab0bfc11 | 173 | * @} |
| Kojto | 109:9296ab0bfc11 | 174 | */ |
| Kojto | 109:9296ab0bfc11 | 175 | |
| Kojto | 109:9296ab0bfc11 | 176 | /** @addtogroup ADC_Exported_Functions_Group3 Peripheral Control functions |
| Kojto | 109:9296ab0bfc11 | 177 | * @brief Peripheral Control functions |
| Kojto | 109:9296ab0bfc11 | 178 | * @{ |
| Kojto | 109:9296ab0bfc11 | 179 | */ |
| Kojto | 109:9296ab0bfc11 | 180 | /* Peripheral Control functions ***********************************************/ |
| Kojto | 109:9296ab0bfc11 | 181 | HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig); |
| Kojto | 109:9296ab0bfc11 | 182 | HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig); |
| Kojto | 109:9296ab0bfc11 | 183 | /** |
| Kojto | 109:9296ab0bfc11 | 184 | * @} |
| Kojto | 109:9296ab0bfc11 | 185 | */ |
| Kojto | 109:9296ab0bfc11 | 186 | |
| Kojto | 109:9296ab0bfc11 | 187 | /** @defgroup ADC_Exported_Functions_Group4 Peripheral State functions |
| Kojto | 109:9296ab0bfc11 | 188 | * @brief ADC Peripheral State functions |
| Kojto | 109:9296ab0bfc11 | 189 | * @{ |
| Kojto | 109:9296ab0bfc11 | 190 | */ |
| Kojto | 109:9296ab0bfc11 | 191 | /* Peripheral State functions *************************************************/ |
| Kojto | 109:9296ab0bfc11 | 192 | HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc); |
| Kojto | 109:9296ab0bfc11 | 193 | uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc); |
| Kojto | 109:9296ab0bfc11 | 194 | /** |
| Kojto | 109:9296ab0bfc11 | 195 | * @} |
| Kojto | 109:9296ab0bfc11 | 196 | */ |
| Kojto | 109:9296ab0bfc11 | 197 | |
| Kojto | 109:9296ab0bfc11 | 198 | /** |
| Kojto | 109:9296ab0bfc11 | 199 | * @} |
| Kojto | 109:9296ab0bfc11 | 200 | */ |
| Kojto | 109:9296ab0bfc11 | 201 | |
| Kojto | 109:9296ab0bfc11 | 202 | /** |
| Kojto | 109:9296ab0bfc11 | 203 | * @} |
| Kojto | 109:9296ab0bfc11 | 204 | */ |
| Kojto | 109:9296ab0bfc11 | 205 | |
| Kojto | 109:9296ab0bfc11 | 206 | /** |
| Kojto | 109:9296ab0bfc11 | 207 | * @} |
| Kojto | 109:9296ab0bfc11 | 208 | */ |
| Kojto | 109:9296ab0bfc11 | 209 | |
| Kojto | 109:9296ab0bfc11 | 210 | #ifdef __cplusplus |
| Kojto | 109:9296ab0bfc11 | 211 | } |
| Kojto | 109:9296ab0bfc11 | 212 | #endif |
| Kojto | 109:9296ab0bfc11 | 213 | |
| Kojto | 109:9296ab0bfc11 | 214 | #endif /*__STM32F3xx_ADC_H */ |
| Kojto | 109:9296ab0bfc11 | 215 | |
| Kojto | 109:9296ab0bfc11 | 216 | |
| Kojto | 109:9296ab0bfc11 | 217 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |


