mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

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