source: asp3_wo_tecs/trunk/arch/arm_m_gcc/stm32f4xx_stm32cube/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_lptim.h@ 303

Last change on this file since 303 was 303, checked in by ertl-honda, 7 years ago

nucleo_f401re依存部の追加

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