my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
90:cb3d968589d8
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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