]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3 / stm32f3xx_hal_comp.h
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_hal_comp.h
4 * @author MCD Application Team
5 * @version V1.1.0
6 * @date 12-Sept-2014
7 * @brief Header file of COMP HAL module.
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_HAL_COMP_H
40 #define __STM32F3xx_HAL_COMP_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f3xx_hal_def.h"
48
49 /** @addtogroup STM32F3xx_HAL_Driver
50 * @{
51 */
52
53 /** @addtogroup COMP
54 * @{
55 */
56
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup COMP_Exported_Types COMP Exported Types
59 * @{
60 */
61 /**
62 * @brief COMP Init structure definition
63 */
64
65 typedef struct
66 {
67
68 uint32_t InvertingInput; /*!< Selects the inverting input of the comparator.
69 This parameter can be a value of @ref COMPEx_InvertingInput */
70
71 uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator.
72 This parameter can be a value of @ref COMPEx_NonInvertingInput
73 Note: Only available on STM32F302xB/xC, STM32F303xB/xC and STM32F358xx devices */
74
75 uint32_t Output; /*!< Selects the output redirection of the comparator.
76 This parameter can be a value of @ref COMPEx_Output */
77
78 uint32_t OutputPol; /*!< Selects the output polarity of the comparator.
79 This parameter can be a value of @ref COMP_OutputPolarity */
80
81 uint32_t Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
82 This parameter can be a value of @ref COMPEx_Hysteresis
83 Note: Only available on STM32F302xB/xC, STM32F303xB/xC, STM32F373xB/xC, STM32F358xx and STM32F378xx devices */
84
85 uint32_t BlankingSrce; /*!< Selects the output blanking source of the comparator.
86 This parameter can be a value of @ref COMPEx_BlankingSrce
87 Note: Not available on STM32F373xB/C and STM32F378xx devices */
88
89 uint32_t Mode; /*!< Selects the operating comsumption mode of the comparator
90 to adjust the speed/consumption.
91 This parameter can be a value of @ref COMPEx_Mode
92 Note: Not available on STM32F301x6/x8, STM32F302x6/x8, STM32F334x6/x8, STM32F318xx and STM32F328xx devices */
93
94 uint32_t WindowMode; /*!< Selects the window mode of the comparator X (X=2, 4 or 6 if available).
95 This parameter can be a value of @ref COMPEx_WindowMode */
96
97 uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator (interrupt mode).
98 This parameter can be a value of @ref COMP_TriggerMode */
99
100 }COMP_InitTypeDef;
101
102 /**
103 * @brief HAL State structures definition
104 */
105 typedef enum
106 {
107 HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */
108 HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */
109 HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */
110 HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */
111 HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */
112 }HAL_COMP_StateTypeDef;
113
114
115 /**
116 * @brief PPP Handle Structure definition
117 */
118 typedef struct
119 {
120 COMP_TypeDef *Instance; /*!< Register base address */
121 COMP_InitTypeDef Init; /*!< COMP required parameters */
122 HAL_LockTypeDef Lock; /*!< Locking object */
123 __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
124
125 }COMP_HandleTypeDef;
126
127 /**
128 * @}
129 */
130
131 /* Exported constants --------------------------------------------------------*/
132 /** @defgroup COMP_Exported_Constants COMP Exported Constants
133 * @{
134 */
135
136 /** @defgroup COMP_OutputPolarity COMP Output Polarity
137 * @{
138 */
139 #define COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
140 #define COMP_OUTPUTPOL_INVERTED COMP_CSR_COMPxPOL /*!< COMP output on GPIO is inverted */
141 #define IS_COMP_OUTPUTPOL(POL) (((POL) == COMP_OUTPUTPOL_NONINVERTED) || \
142 ((POL) == COMP_OUTPUTPOL_INVERTED))
143 /**
144 * @}
145 */
146
147 /** @defgroup COMP_OutputLevel COMP Output Level
148 * @{
149 */
150 /* When output polarity is not inverted, comparator output is low when
151 the non-inverting input is at a lower voltage than the inverting input*/
152 #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000)
153 /* When output polarity is not inverted, comparator output is high when
154 the non-inverting input is at a higher voltage than the inverting input */
155 #define COMP_OUTPUTLEVEL_HIGH COMP_CSR_COMPxOUT
156 /**
157 * @}
158 */
159
160 /** @defgroup COMP_TriggerMode COMP Trigger Mode
161 * @{
162 */
163 #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */
164 #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
165 #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
166 #define COMP_TRIGGERMODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
167 #define IS_COMP_TRIGGERMODE(MODE) (((MODE) == COMP_TRIGGERMODE_NONE) || \
168 ((MODE) == COMP_TRIGGERMODE_IT_RISING) || \
169 ((MODE) == COMP_TRIGGERMODE_IT_FALLING) || \
170 ((MODE) == COMP_TRIGGERMODE_IT_RISING_FALLING))
171 /**
172 * @}
173 */
174
175 #define COMP_LOCK_DISABLE ((uint32_t)0x00000000)
176 #define COMP_LOCK_ENABLE COMP_CSR_COMPxLOCK
177
178 #define COMP_STATE_BIT_LOCK ((uint32_t)0x10)
179
180 /**
181 * @}
182 */
183
184 /* Exported macros -----------------------------------------------------------*/
185 /** @defgroup COMP_Exported_Macros COMP Exported Macros
186 * @{
187 */
188
189 /** @brief Reset COMP handle state
190 * @param __HANDLE__: COMP handle.
191 * @retval None
192 */
193 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
194 /**
195 * @}
196 */
197
198 /* Include COMP HAL Extended module */
199 #include "stm32f3xx_hal_comp_ex.h"
200
201 /* Exported functions --------------------------------------------------------*/
202 /** @addtogroup COMP_Exported_Functions COMP Exported Functions
203 * @{
204 */
205
206 /** @addtogroup COMP_Exported_Functions_Group1 Initialization and de-initialization functions
207 * @brief Initialization and Configuration functions
208 * @{
209 */
210 /* Initialization and de-initialization functions ****************************/
211 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
212 HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp);
213 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
214 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
215 /**
216 * @}
217 */
218
219 /** @addtogroup COMP_Exported_Functions_Group2 Input and Output operation functions
220 * @brief Data transfers functions
221 * @{
222 */
223 /* IO operation functions *****************************************************/
224 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
225 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
226 HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp);
227 HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp);
228 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
229 /**
230 * @}
231 */
232
233 /** @addtogroup COMP_Exported_Functions_Group3 Peripheral Control functions
234 * @brief management functions
235 * @{
236 */
237 /* Peripheral Control functions ***********************************************/
238 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
239 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
240
241 /* Callback in Interrupt mode */
242 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
243 /**
244 * @}
245 */
246
247 /** @addtogroup COMP_Exported_Functions_Group4 Peripheral State functions
248 * @brief Peripheral State functions
249 * @{
250 */
251 /* Peripheral State and Error functions ***************************************/
252 HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
253 /**
254 * @}
255 */
256
257 /**
258 * @}
259 */
260
261 /**
262 * @}
263 */
264
265 /**
266 * @}
267 */
268
269 #ifdef __cplusplus
270 }
271 #endif
272
273 #endif /* __STM32F3xx_HAL_COMP_H */
274
275 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum