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