Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_lptim.h @ 128:c78bcbd5deda FlipDisplay
Added current STM32 standandard libraries in version independend folder structure
author | Ideenmodellierer |
---|---|
date | Sun, 17 Feb 2019 21:12:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
127:1369f8660eaa | 128:c78bcbd5deda |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_lptim.h | |
4 * @author MCD Application Team | |
5 * @brief Header file of LPTIM HAL module. | |
6 ****************************************************************************** | |
7 * @attention | |
8 * | |
9 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |
10 * | |
11 * Redistribution and use in source and binary forms, with or without modification, | |
12 * are permitted provided that the following conditions are met: | |
13 * 1. Redistributions of source code must retain the above copyright notice, | |
14 * this list of conditions and the following disclaimer. | |
15 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
16 * this list of conditions and the following disclaimer in the documentation | |
17 * and/or other materials provided with the distribution. | |
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors | |
19 * may be used to endorse or promote products derived from this software | |
20 * without specific prior written permission. | |
21 * | |
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 * | |
33 ****************************************************************************** | |
34 */ | |
35 | |
36 /* Define to prevent recursive inclusion -------------------------------------*/ | |
37 #ifndef __STM32F4xx_HAL_LPTIM_H | |
38 #define __STM32F4xx_HAL_LPTIM_H | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 | |
44 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |
45 /* Includes ------------------------------------------------------------------*/ | |
46 #include "stm32f4xx_hal_def.h" | |
47 | |
48 /** @addtogroup STM32F4xx_HAL_Driver | |
49 * @{ | |
50 */ | |
51 | |
52 /** @defgroup LPTIM LPTIM | |
53 * @brief LPTIM HAL module driver | |
54 * @{ | |
55 */ | |
56 | |
57 /* Exported types ------------------------------------------------------------*/ | |
58 /** @defgroup LPTIM_Exported_Types LPTIM Exported Types | |
59 * @{ | |
60 */ | |
61 | |
62 /** @defgroup LPTIM_WAKEUPTIMER_EXTILINE LPTIM WAKEUP Timer EXTI Line | |
63 * @{ | |
64 */ | |
65 #define LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR23) /*!< External interrupt line 23 Connected to the LPTIM EXTI Line */ | |
66 /** | |
67 * @} | |
68 */ | |
69 | |
70 /** | |
71 * @brief LPTIM Clock configuration definition | |
72 */ | |
73 typedef struct | |
74 { | |
75 uint32_t Source; /*!< Selects the clock source. | |
76 This parameter can be a value of @ref LPTIM_Clock_Source */ | |
77 | |
78 uint32_t Prescaler; /*!< Specifies the counter clock Prescaler. | |
79 This parameter can be a value of @ref LPTIM_Clock_Prescaler */ | |
80 | |
81 }LPTIM_ClockConfigTypeDef; | |
82 | |
83 /** | |
84 * @brief LPTIM Clock configuration definition | |
85 */ | |
86 typedef struct | |
87 { | |
88 uint32_t Polarity; /*!< Selects the polarity of the active edge for the counter unit | |
89 if the ULPTIM input is selected. | |
90 Note: This parameter is used only when Ultra low power clock source is used. | |
91 Note: If the polarity is configured on 'both edges', an auxiliary clock | |
92 (one of the Low power oscillator) must be active. | |
93 This parameter can be a value of @ref LPTIM_Clock_Polarity */ | |
94 | |
95 uint32_t SampleTime; /*!< Selects the clock sampling time to configure the clock glitch filter. | |
96 Note: This parameter is used only when Ultra low power clock source is used. | |
97 This parameter can be a value of @ref LPTIM_Clock_Sample_Time */ | |
98 | |
99 }LPTIM_ULPClockConfigTypeDef; | |
100 | |
101 /** | |
102 * @brief LPTIM Trigger configuration definition | |
103 */ | |
104 typedef struct | |
105 { | |
106 uint32_t Source; /*!< Selects the Trigger source. | |
107 This parameter can be a value of @ref LPTIM_Trigger_Source */ | |
108 | |
109 uint32_t ActiveEdge; /*!< Selects the Trigger active edge. | |
110 Note: This parameter is used only when an external trigger is used. | |
111 This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */ | |
112 | |
113 uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter. | |
114 Note: This parameter is used only when an external trigger is used. | |
115 This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */ | |
116 }LPTIM_TriggerConfigTypeDef; | |
117 | |
118 /** | |
119 * @brief LPTIM Initialization Structure definition | |
120 */ | |
121 typedef struct | |
122 { | |
123 LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */ | |
124 | |
125 LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */ | |
126 | |
127 LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */ | |
128 | |
129 uint32_t OutputPolarity; /*!< Specifies the Output polarity. | |
130 This parameter can be a value of @ref LPTIM_Output_Polarity */ | |
131 | |
132 uint32_t UpdateMode; /*!< Specifies whether the update of the autorelaod and the compare | |
133 values is done immediately or after the end of current period. | |
134 This parameter can be a value of @ref LPTIM_Updating_Mode */ | |
135 | |
136 uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event | |
137 or each external event. | |
138 This parameter can be a value of @ref LPTIM_Counter_Source */ | |
139 | |
140 }LPTIM_InitTypeDef; | |
141 | |
142 /** | |
143 * @brief HAL LPTIM State structure definition | |
144 */ | |
145 typedef enum __HAL_LPTIM_StateTypeDef | |
146 { | |
147 HAL_LPTIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */ | |
148 HAL_LPTIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ | |
149 HAL_LPTIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */ | |
150 HAL_LPTIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ | |
151 HAL_LPTIM_STATE_ERROR = 0x04U /*!< Internal Process is ongoing */ | |
152 }HAL_LPTIM_StateTypeDef; | |
153 | |
154 /** | |
155 * @brief LPTIM handle Structure definition | |
156 */ | |
157 typedef struct | |
158 { | |
159 LPTIM_TypeDef *Instance; /*!< Register base address */ | |
160 | |
161 LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */ | |
162 | |
163 HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */ | |
164 | |
165 HAL_LockTypeDef Lock; /*!< LPTIM locking object */ | |
166 | |
167 __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */ | |
168 | |
169 }LPTIM_HandleTypeDef; | |
170 | |
171 /** | |
172 * @} | |
173 */ | |
174 | |
175 /* Exported constants --------------------------------------------------------*/ | |
176 /** @defgroup LPTIM_Exported_Constants LPTIM Exported Constants | |
177 * @{ | |
178 */ | |
179 | |
180 /** @defgroup LPTIM_Clock_Source LPTIM Clock Source | |
181 * @{ | |
182 */ | |
183 #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC 0x00U | |
184 #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL | |
185 /** | |
186 * @} | |
187 */ | |
188 | |
189 /** @defgroup LPTIM_Clock_Prescaler LPTIM Clock Prescaler | |
190 * @{ | |
191 */ | |
192 #define LPTIM_PRESCALER_DIV1 0x00000000U | |
193 #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 | |
194 #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 | |
195 #define LPTIM_PRESCALER_DIV8 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1)) | |
196 #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 | |
197 #define LPTIM_PRESCALER_DIV32 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2)) | |
198 #define LPTIM_PRESCALER_DIV64 ((uint32_t)(LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2)) | |
199 #define LPTIM_PRESCALER_DIV128 ((uint32_t)LPTIM_CFGR_PRESC) | |
200 /** | |
201 * @} | |
202 */ | |
203 | |
204 /** @defgroup LPTIM_Output_Polarity LPTIM Output Polarity | |
205 * @{ | |
206 */ | |
207 | |
208 #define LPTIM_OUTPUTPOLARITY_HIGH 0x00000000U | |
209 #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL) | |
210 /** | |
211 * @} | |
212 */ | |
213 | |
214 /** @defgroup LPTIM_Clock_Sample_Time LPTIM Clock Sample Time | |
215 * @{ | |
216 */ | |
217 #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION 0x00000000U | |
218 #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0 | |
219 #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1 | |
220 #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT | |
221 /** | |
222 * @} | |
223 */ | |
224 | |
225 /** @defgroup LPTIM_Clock_Polarity LPTIM Clock Polarity | |
226 * @{ | |
227 */ | |
228 | |
229 #define LPTIM_CLOCKPOLARITY_RISING 0x00000000U | |
230 #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0 | |
231 #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 | |
232 /** | |
233 * @} | |
234 */ | |
235 | |
236 /** @defgroup LPTIM_Trigger_Source LPTIM Trigger Source | |
237 * @{ | |
238 */ | |
239 #define LPTIM_TRIGSOURCE_SOFTWARE 0x0000FFFFU | |
240 #define LPTIM_TRIGSOURCE_0 0x00000000U | |
241 #define LPTIM_TRIGSOURCE_1 ((uint32_t)LPTIM_CFGR_TRIGSEL_0) | |
242 #define LPTIM_TRIGSOURCE_2 LPTIM_CFGR_TRIGSEL_1 | |
243 #define LPTIM_TRIGSOURCE_3 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_1) | |
244 #define LPTIM_TRIGSOURCE_4 LPTIM_CFGR_TRIGSEL_2 | |
245 #define LPTIM_TRIGSOURCE_5 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2) | |
246 /** | |
247 * @} | |
248 */ | |
249 | |
250 /** @defgroup LPTIM_External_Trigger_Polarity LPTIM External Trigger Polarity | |
251 * @{ | |
252 */ | |
253 #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0 | |
254 #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1 | |
255 #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN | |
256 /** | |
257 * @} | |
258 */ | |
259 | |
260 /** @defgroup LPTIM_Trigger_Sample_Time LPTIM Trigger Sample Time | |
261 * @{ | |
262 */ | |
263 #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION 0x00000000U | |
264 #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0 | |
265 #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1 | |
266 #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT | |
267 /** | |
268 * @} | |
269 */ | |
270 | |
271 /** @defgroup LPTIM_Updating_Mode LPTIM Updating Mode | |
272 * @{ | |
273 */ | |
274 | |
275 #define LPTIM_UPDATE_IMMEDIATE 0x00000000U | |
276 #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD | |
277 /** | |
278 * @} | |
279 */ | |
280 | |
281 /** @defgroup LPTIM_Counter_Source LPTIM Counter Source | |
282 * @{ | |
283 */ | |
284 | |
285 #define LPTIM_COUNTERSOURCE_INTERNAL 0x00000000U | |
286 #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE | |
287 /** | |
288 * @} | |
289 */ | |
290 | |
291 /** @defgroup LPTIM_Flag_Definition LPTIM Flag Definition | |
292 * @{ | |
293 */ | |
294 | |
295 #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN | |
296 #define LPTIM_FLAG_UP LPTIM_ISR_UP | |
297 #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK | |
298 #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK | |
299 #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG | |
300 #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM | |
301 #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM | |
302 /** | |
303 * @} | |
304 */ | |
305 | |
306 /** @defgroup LPTIM_Interrupts_Definition LPTIM Interrupts Definition | |
307 * @{ | |
308 */ | |
309 | |
310 #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE | |
311 #define LPTIM_IT_UP LPTIM_IER_UPIE | |
312 #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE | |
313 #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE | |
314 #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE | |
315 #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE | |
316 #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE | |
317 /** | |
318 * @} | |
319 */ | |
320 | |
321 /** @defgroup LPTIM_Option Register Definition | |
322 * @{ | |
323 */ | |
324 #define LPTIM_OP_PAD_AF 0x00000000U | |
325 #define LPTIM_OP_PAD_PA4 LPTIM_OR_LPT_IN1_RMP_0 | |
326 #define LPTIM_OP_PAD_PB9 LPTIM_OR_LPT_IN1_RMP_1 | |
327 #define LPTIM_OP_TIM_DAC LPTIM_OR_LPT_IN1_RMP | |
328 | |
329 /** | |
330 * @} | |
331 */ | |
332 | |
333 /** | |
334 * @} | |
335 */ | |
336 | |
337 /* Exported macro ------------------------------------------------------------*/ | |
338 /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros | |
339 * @{ | |
340 */ | |
341 | |
342 /** @brief Reset LPTIM handle state | |
343 * @param __HANDLE__ LPTIM handle | |
344 * @retval None | |
345 */ | |
346 #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET) | |
347 | |
348 /** | |
349 * @brief Enable/Disable the LPTIM peripheral. | |
350 * @param __HANDLE__ LPTIM handle | |
351 * @retval None | |
352 */ | |
353 #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE)) | |
354 #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE)) | |
355 | |
356 /** | |
357 * @brief Starts the LPTIM peripheral in Continuous or in single mode. | |
358 * @param __HANDLE__ DMA handle | |
359 * @retval None | |
360 */ | |
361 #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT) | |
362 #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT) | |
363 | |
364 | |
365 /** | |
366 * @brief Writes the passed parameter in the Autoreload register. | |
367 * @param __HANDLE__ LPTIM handle | |
368 * @param __VALUE__ Autoreload value | |
369 * @retval None | |
370 */ | |
371 #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__)) | |
372 | |
373 /** | |
374 * @brief Writes the passed parameter in the Compare register. | |
375 * @param __HANDLE__ LPTIM handle | |
376 * @param __VALUE__ Compare value | |
377 * @retval None | |
378 */ | |
379 #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__)) | |
380 | |
381 /** | |
382 * @brief Checks whether the specified LPTIM flag is set or not. | |
383 * @param __HANDLE__ LPTIM handle | |
384 * @param __FLAG__ LPTIM flag to check | |
385 * This parameter can be a value of: | |
386 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. | |
387 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. | |
388 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. | |
389 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. | |
390 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. | |
391 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. | |
392 * @arg LPTIM_FLAG_CMPM : Compare match Flag. | |
393 * @retval The state of the specified flag (SET or RESET). | |
394 */ | |
395 #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__)) | |
396 | |
397 /** | |
398 * @brief Clears the specified LPTIM flag. | |
399 * @param __HANDLE__ LPTIM handle. | |
400 * @param __FLAG__ LPTIM flag to clear. | |
401 * This parameter can be a value of: | |
402 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. | |
403 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. | |
404 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. | |
405 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. | |
406 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. | |
407 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. | |
408 * @arg LPTIM_FLAG_CMPM : Compare match Flag. | |
409 * @retval None. | |
410 */ | |
411 #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) | |
412 | |
413 /** | |
414 * @brief Enable the specified LPTIM interrupt. | |
415 * @param __HANDLE__ LPTIM handle. | |
416 * @param __INTERRUPT__ LPTIM interrupt to set. | |
417 * This parameter can be a value of: | |
418 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |
419 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |
420 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |
421 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |
422 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |
423 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |
424 * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |
425 * @retval None. | |
426 */ | |
427 #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) | |
428 | |
429 /** | |
430 * @brief Disable the specified LPTIM interrupt. | |
431 * @param __HANDLE__ LPTIM handle. | |
432 * @param __INTERRUPT__ LPTIM interrupt to set. | |
433 * This parameter can be a value of: | |
434 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |
435 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |
436 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |
437 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |
438 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |
439 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |
440 * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |
441 * @retval None. | |
442 */ | |
443 #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__))) | |
444 | |
445 /** | |
446 * @brief Checks whether the specified LPTIM interrupt is set or not. | |
447 * @param __HANDLE__ LPTIM handle. | |
448 * @param __INTERRUPT__ LPTIM interrupt to check. | |
449 * This parameter can be a value of: | |
450 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |
451 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |
452 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |
453 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |
454 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |
455 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |
456 * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |
457 * @retval Interrupt status. | |
458 */ | |
459 | |
460 #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |
461 | |
462 /** @brief LPTIM Option Register | |
463 * @param __HANDLE__ LPTIM handle | |
464 * @param __VALUE__ This parameter can be a value of : | |
465 * @arg LPTIM_OP_PAD_AF | |
466 * @arg LPTIM_OP_PAD_PA4 | |
467 * @arg LPTIM_OP_PAD_PB9 | |
468 * @arg LPTIM_OP_TIM_DAC | |
469 * @retval None | |
470 */ | |
471 #define __HAL_LPTIM_OPTR_CONFIG(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->OR = (__VALUE__)) | |
472 | |
473 /** | |
474 * @brief Enable interrupt on the LPTIM Wake-up Timer associated Exti line. | |
475 * @retval None | |
476 */ | |
477 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
478 | |
479 /** | |
480 * @brief Disable interrupt on the LPTIM Wake-up Timer associated Exti line. | |
481 * @retval None | |
482 */ | |
483 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |
484 | |
485 /** | |
486 * @brief Enable event on the LPTIM Wake-up Timer associated Exti line. | |
487 * @retval None. | |
488 */ | |
489 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
490 | |
491 /** | |
492 * @brief Disable event on the LPTIM Wake-up Timer associated Exti line. | |
493 * @retval None. | |
494 */ | |
495 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |
496 | |
497 /** | |
498 * @brief Enable falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
499 * @retval None. | |
500 */ | |
501 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
502 | |
503 /** | |
504 * @brief Disable falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
505 * @retval None. | |
506 */ | |
507 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |
508 | |
509 /** | |
510 * @brief Enable rising edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
511 * @retval None. | |
512 */ | |
513 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
514 | |
515 /** | |
516 * @brief Disable rising edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
517 * @retval None. | |
518 */ | |
519 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |
520 | |
521 /** | |
522 * @brief Enable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
523 * @retval None. | |
524 */ | |
525 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\ | |
526 __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\ | |
527 }while(0U) | |
528 | |
529 /** | |
530 * @brief Disable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |
531 * This parameter can be: | |
532 * @retval None. | |
533 */ | |
534 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\ | |
535 __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\ | |
536 }while(0U) | |
537 | |
538 /** | |
539 * @brief Check whether the LPTIM Wake-up Timer associated Exti line interrupt flag is set or not. | |
540 * @retval Line Status. | |
541 */ | |
542 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
543 | |
544 /** | |
545 * @brief Clear the LPTIM Wake-up Timer associated Exti line flag. | |
546 * @retval None. | |
547 */ | |
548 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
549 | |
550 /** | |
551 * @brief Generate a Software interrupt on the LPTIM Wake-up Timer associated Exti line. | |
552 * @retval None. | |
553 */ | |
554 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |
555 | |
556 /** | |
557 * @} | |
558 */ | |
559 /* Exported functions --------------------------------------------------------*/ | |
560 /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions | |
561 * @{ | |
562 */ | |
563 | |
564 /* Initialization/de-initialization functions ********************************/ | |
565 HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim); | |
566 HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim); | |
567 | |
568 /* MSP functions *************************************************************/ | |
569 void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim); | |
570 void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim); | |
571 | |
572 /* Start/Stop operation functions *********************************************/ | |
573 /* ################################# PWM Mode ################################*/ | |
574 /* Blocking mode: Polling */ | |
575 HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
576 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim); | |
577 /* Non-Blocking mode: Interrupt */ | |
578 HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
579 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
580 | |
581 /* ############################# One Pulse Mode ##############################*/ | |
582 /* Blocking mode: Polling */ | |
583 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
584 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim); | |
585 /* Non-Blocking mode: Interrupt */ | |
586 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
587 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
588 | |
589 /* ############################## Set once Mode ##############################*/ | |
590 /* Blocking mode: Polling */ | |
591 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
592 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim); | |
593 /* Non-Blocking mode: Interrupt */ | |
594 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |
595 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
596 | |
597 /* ############################### Encoder Mode ##############################*/ | |
598 /* Blocking mode: Polling */ | |
599 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |
600 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim); | |
601 /* Non-Blocking mode: Interrupt */ | |
602 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |
603 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
604 | |
605 /* ############################# Time out Mode ##############################*/ | |
606 /* Blocking mode: Polling */ | |
607 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); | |
608 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim); | |
609 /* Non-Blocking mode: Interrupt */ | |
610 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); | |
611 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
612 | |
613 /* ############################## Counter Mode ###############################*/ | |
614 /* Blocking mode: Polling */ | |
615 HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |
616 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim); | |
617 /* Non-Blocking mode: Interrupt */ | |
618 HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |
619 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |
620 | |
621 /* Reading operation functions ************************************************/ | |
622 uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim); | |
623 uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim); | |
624 uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim); | |
625 | |
626 /* LPTIM IRQ functions *******************************************************/ | |
627 void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim); | |
628 | |
629 /* CallBack functions ********************************************************/ | |
630 void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim); | |
631 void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim); | |
632 void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim); | |
633 void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim); | |
634 void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim); | |
635 void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim); | |
636 void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim); | |
637 | |
638 /* Peripheral State functions ************************************************/ | |
639 HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim); | |
640 | |
641 /** | |
642 * @} | |
643 */ | |
644 | |
645 /* Private types -------------------------------------------------------------*/ | |
646 /** @defgroup LPTIM_Private_Types LPTIM Private Types | |
647 * @{ | |
648 */ | |
649 | |
650 /** | |
651 * @} | |
652 */ | |
653 | |
654 /* Private variables ---------------------------------------------------------*/ | |
655 /** @defgroup LPTIM_Private_Variables LPTIM Private Variables | |
656 * @{ | |
657 */ | |
658 | |
659 /** | |
660 * @} | |
661 */ | |
662 | |
663 /* Private constants ---------------------------------------------------------*/ | |
664 /** @defgroup LPTIM_Private_Constants LPTIM Private Constants | |
665 * @{ | |
666 */ | |
667 | |
668 /** | |
669 * @} | |
670 */ | |
671 | |
672 /* Private macros ------------------------------------------------------------*/ | |
673 /** @defgroup LPTIM_Private_Macros LPTIM Private Macros | |
674 * @{ | |
675 */ | |
676 | |
677 #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \ | |
678 ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC)) | |
679 | |
680 #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \ | |
681 ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \ | |
682 ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \ | |
683 ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \ | |
684 ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \ | |
685 ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \ | |
686 ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \ | |
687 ((__PRESCALER__) == LPTIM_PRESCALER_DIV128)) | |
688 #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1) | |
689 | |
690 #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \ | |
691 ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH)) | |
692 | |
693 #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \ | |
694 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \ | |
695 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \ | |
696 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS)) | |
697 | |
698 #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \ | |
699 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \ | |
700 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING)) | |
701 | |
702 #define IS_LPTIM_TRG_SOURCE(__TRIG__) (((__TRIG__) == LPTIM_TRIGSOURCE_SOFTWARE) || \ | |
703 ((__TRIG__) == LPTIM_TRIGSOURCE_0) || \ | |
704 ((__TRIG__) == LPTIM_TRIGSOURCE_1) || \ | |
705 ((__TRIG__) == LPTIM_TRIGSOURCE_2) || \ | |
706 ((__TRIG__) == LPTIM_TRIGSOURCE_3) || \ | |
707 ((__TRIG__) == LPTIM_TRIGSOURCE_4) || \ | |
708 ((__TRIG__) == LPTIM_TRIGSOURCE_5)) | |
709 | |
710 #define IS_LPTIM_EXT_TRG_POLARITY(__POLAR__) (((__POLAR__) == LPTIM_ACTIVEEDGE_RISING ) || \ | |
711 ((__POLAR__) == LPTIM_ACTIVEEDGE_FALLING ) || \ | |
712 ((__POLAR__) == LPTIM_ACTIVEEDGE_RISING_FALLING )) | |
713 | |
714 #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION) || \ | |
715 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \ | |
716 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \ | |
717 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS )) | |
718 | |
719 #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \ | |
720 ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD)) | |
721 | |
722 #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \ | |
723 ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL)) | |
724 | |
725 #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFFU) | |
726 | |
727 #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFU) | |
728 | |
729 #define IS_LPTIM_PERIOD(PERIOD) ((PERIOD) <= 0x0000FFFFU) | |
730 | |
731 #define IS_LPTIM_PULSE(PULSE) ((PULSE) <= 0x0000FFFFU) | |
732 | |
733 /** | |
734 * @} | |
735 */ | |
736 | |
737 /* Private functions ---------------------------------------------------------*/ | |
738 /** @defgroup LPTIM_Private_Functions LPTIM Private Functions | |
739 * @{ | |
740 */ | |
741 | |
742 /** | |
743 * @} | |
744 */ | |
745 | |
746 /** | |
747 * @} | |
748 */ | |
749 | |
750 /** | |
751 * @} | |
752 */ | |
753 | |
754 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ | |
755 #ifdef __cplusplus | |
756 } | |
757 #endif | |
758 | |
759 #endif /* __STM32F4xx_HAL_LPTIM_H */ | |
760 | |
761 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |