Modified version of the mbed library for use with the Nucleo boards.

Dependents:   EEPROMWrite Full-Project

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Sep 28 14:00:11 2015 +0100
Revision:
632:7687fb9c4f91
Parent:
385:be64abf45658
Child:
634:ac7d6880524d
Synchronized with git revision f7ce4ed029cc611121464252ff28d5e8beb895b0

Full URL: https://github.com/mbedmicro/mbed/commit/f7ce4ed029cc611121464252ff28d5e8beb895b0/

NUCLEO_F303K8 - add support of the STM32F303K8

Who changed what in which revision?

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