Merge pull request #10592 from iNavFlight/MrD_Update-parameter-description
[inav.git] / lib / main / STM32F7 / Drivers / STM32F7xx_HAL_Driver / Inc / stm32f7xx_hal_lptim.h
blob151e77fb4d37a73bd4e982d61489692521fb8b9e
1 /**
2 ******************************************************************************
3 * @file stm32f7xx_hal_lptim.h
4 * @author MCD Application Team
5 * @version V1.2.2
6 * @date 14-April-2017
7 * @brief Header file of LPTIM HAL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
36 */
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F7xx_HAL_LPTIM_H
40 #define __STM32F7xx_HAL_LPTIM_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f7xx_hal_def.h"
49 /** @addtogroup STM32F7xx_HAL_Driver
50 * @{
53 /** @defgroup LPTIM LPTIM
54 * @brief LPTIM HAL module driver
55 * @{
58 /* Exported types ------------------------------------------------------------*/
59 /** @defgroup LPTIM_Exported_Types LPTIM Exported Types
60 * @{
63 /** @defgroup LPTIM_WAKEUPTIMER_EXTILINE LPTIM WAKEUP Timer EXTI Line
64 * @{
66 #define LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR23) /*!< External interrupt line 23 Connected to the LPTIM EXTI Line */
67 /**
68 * @}
71 /**
72 * @brief LPTIM Clock configuration definition
74 typedef struct
76 uint32_t Source; /*!< Selects the clock source.
77 This parameter can be a value of @ref LPTIM_Clock_Source */
79 uint32_t Prescaler; /*!< Specifies the counter clock Prescaler.
80 This parameter can be a value of @ref LPTIM_Clock_Prescaler */
82 }LPTIM_ClockConfigTypeDef;
84 /**
85 * @brief LPTIM Clock configuration definition
87 typedef struct
89 uint32_t Polarity; /*!< Selects the polarity of the active edge for the counter unit
90 if the ULPTIM input is selected.
91 Note: This parameter is used only when Ultra low power clock source is used.
92 Note: If the polarity is configured on 'both edges', an auxiliary clock
93 (one of the Low power oscillator) must be active.
94 This parameter can be a value of @ref LPTIM_Clock_Polarity */
96 uint32_t SampleTime; /*!< Selects the clock sampling time to configure the clock glitch filter.
97 Note: This parameter is used only when Ultra low power clock source is used.
98 This parameter can be a value of @ref LPTIM_Clock_Sample_Time */
100 }LPTIM_ULPClockConfigTypeDef;
102 /**
103 * @brief LPTIM Trigger configuration definition
105 typedef struct
107 uint32_t Source; /*!< Selects the Trigger source.
108 This parameter can be a value of @ref LPTIM_Trigger_Source */
110 uint32_t ActiveEdge; /*!< Selects the Trigger active edge.
111 Note: This parameter is used only when an external trigger is used.
112 This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */
114 uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter.
115 Note: This parameter is used only when an external trigger is used.
116 This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */
117 }LPTIM_TriggerConfigTypeDef;
119 /**
120 * @brief LPTIM Initialization Structure definition
122 typedef struct
124 LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */
126 LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */
128 LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */
130 uint32_t OutputPolarity; /*!< Specifies the Output polarity.
131 This parameter can be a value of @ref LPTIM_Output_Polarity */
133 uint32_t UpdateMode; /*!< Specifies whether the update of the autorelaod and the compare
134 values is done immediately or after the end of current period.
135 This parameter can be a value of @ref LPTIM_Updating_Mode */
137 uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event
138 or each external event.
139 This parameter can be a value of @ref LPTIM_Counter_Source */
141 }LPTIM_InitTypeDef;
143 /**
144 * @brief HAL LPTIM State structure definition
146 typedef enum __HAL_LPTIM_StateTypeDef
148 HAL_LPTIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */
149 HAL_LPTIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
150 HAL_LPTIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */
151 HAL_LPTIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */
152 HAL_LPTIM_STATE_ERROR = 0x04U /*!< Internal Process is ongoing */
153 }HAL_LPTIM_StateTypeDef;
155 /**
156 * @brief LPTIM handle Structure definition
158 typedef struct
160 LPTIM_TypeDef *Instance; /*!< Register base address */
162 LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */
164 HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */
166 HAL_LockTypeDef Lock; /*!< LPTIM locking object */
168 __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */
170 }LPTIM_HandleTypeDef;
173 * @}
176 /* Exported constants --------------------------------------------------------*/
177 /** @defgroup LPTIM_Exported_Constants LPTIM Exported Constants
178 * @{
181 /** @defgroup LPTIM_Clock_Source LPTIM Clock Source
182 * @{
184 #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC ((uint32_t)0x00U)
185 #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL
186 /**
187 * @}
190 /** @defgroup LPTIM_Clock_Prescaler LPTIM Clock Prescaler
191 * @{
193 #define LPTIM_PRESCALER_DIV1 ((uint32_t)0x000000U)
194 #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0
195 #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1
196 #define LPTIM_PRESCALER_DIV8 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1))
197 #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2
198 #define LPTIM_PRESCALER_DIV32 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2))
199 #define LPTIM_PRESCALER_DIV64 ((uint32_t)(LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2))
200 #define LPTIM_PRESCALER_DIV128 ((uint32_t)LPTIM_CFGR_PRESC)
202 * @}
205 /** @defgroup LPTIM_Output_Polarity LPTIM Output Polarity
206 * @{
209 #define LPTIM_OUTPUTPOLARITY_HIGH ((uint32_t)0x00000000U)
210 #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL)
212 * @}
215 /** @defgroup LPTIM_Clock_Sample_Time LPTIM Clock Sample Time
216 * @{
218 #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000U)
219 #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0
220 #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1
221 #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT
223 * @}
226 /** @defgroup LPTIM_Clock_Polarity LPTIM Clock Polarity
227 * @{
230 #define LPTIM_CLOCKPOLARITY_RISING ((uint32_t)0x00000000U)
231 #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0
232 #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1
234 * @}
237 /** @defgroup LPTIM_Trigger_Source LPTIM Trigger Source
238 * @{
240 #define LPTIM_TRIGSOURCE_SOFTWARE ((uint32_t)0x0000FFFFU)
241 #define LPTIM_TRIGSOURCE_0 ((uint32_t)0x00000000U)
242 #define LPTIM_TRIGSOURCE_1 ((uint32_t)LPTIM_CFGR_TRIGSEL_0)
243 #define LPTIM_TRIGSOURCE_2 LPTIM_CFGR_TRIGSEL_1
244 #define LPTIM_TRIGSOURCE_3 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_1)
245 #define LPTIM_TRIGSOURCE_4 LPTIM_CFGR_TRIGSEL_2
246 #define LPTIM_TRIGSOURCE_5 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2)
248 * @}
251 /** @defgroup LPTIM_External_Trigger_Polarity LPTIM External Trigger Polarity
252 * @{
254 #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0
255 #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1
256 #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN
258 * @}
261 /** @defgroup LPTIM_Trigger_Sample_Time LPTIM Trigger Sample Time
262 * @{
264 #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000U)
265 #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0
266 #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1
267 #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT
269 * @}
272 /** @defgroup LPTIM_Updating_Mode LPTIM Updating Mode
273 * @{
276 #define LPTIM_UPDATE_IMMEDIATE ((uint32_t)0x00000000U)
277 #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD
279 * @}
282 /** @defgroup LPTIM_Counter_Source LPTIM Counter Source
283 * @{
286 #define LPTIM_COUNTERSOURCE_INTERNAL ((uint32_t)0x00000000U)
287 #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE
289 * @}
292 /** @defgroup LPTIM_Flag_Definition LPTIM Flag Definition
293 * @{
296 #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN
297 #define LPTIM_FLAG_UP LPTIM_ISR_UP
298 #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK
299 #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK
300 #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG
301 #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM
302 #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM
304 * @}
307 /** @defgroup LPTIM_Interrupts_Definition LPTIM Interrupts Definition
308 * @{
311 #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE
312 #define LPTIM_IT_UP LPTIM_IER_UPIE
313 #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE
314 #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE
315 #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE
316 #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE
317 #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE
319 * @}
323 * @}
326 /* Exported macro ------------------------------------------------------------*/
327 /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros
328 * @{
331 /** @brief Reset LPTIM handle state
332 * @param __HANDLE__: LPTIM handle
333 * @retval None
335 #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET)
338 * @brief Enable/Disable the LPTIM peripheral.
339 * @param __HANDLE__: LPTIM handle
340 * @retval None
342 #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE))
343 #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE))
346 * @brief Starts the LPTIM peripheral in Continuous or in single mode.
347 * @param __HANDLE__: DMA handle
348 * @retval None
350 #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT)
351 #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT)
355 * @brief Writes the passed parameter in the Autoreload register.
356 * @param __HANDLE__: LPTIM handle
357 * @param __VALUE__ : Autoreload value
358 * @retval None
360 #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__))
363 * @brief Writes the passed parameter in the Compare register.
364 * @param __HANDLE__: LPTIM handle
365 * @param __VALUE__ : Compare value
366 * @retval None
368 #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__))
371 * @brief Checks whether the specified LPTIM flag is set or not.
372 * @param __HANDLE__: LPTIM handle
373 * @param __FLAG__ : LPTIM flag to check
374 * This parameter can be a value of:
375 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
376 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
377 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
378 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
379 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
380 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
381 * @arg LPTIM_FLAG_CMPM : Compare match Flag.
382 * @retval The state of the specified flag (SET or RESET).
384 #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__))
387 * @brief Clears the specified LPTIM flag.
388 * @param __HANDLE__: LPTIM handle.
389 * @param __FLAG__ : LPTIM flag to clear.
390 * This parameter can be a value of:
391 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
392 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
393 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
394 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
395 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
396 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
397 * @arg LPTIM_FLAG_CMPM : Compare match Flag.
398 * @retval None.
400 #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
403 * @brief Enable the specified LPTIM interrupt.
404 * @param __HANDLE__ : LPTIM handle.
405 * @param __INTERRUPT__ : LPTIM interrupt to set.
406 * This parameter can be a value of:
407 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
408 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
409 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
410 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
411 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
412 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
413 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
414 * @retval None.
416 #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
419 * @brief Disable the specified LPTIM interrupt.
420 * @param __HANDLE__ : LPTIM handle.
421 * @param __INTERRUPT__ : LPTIM interrupt to set.
422 * This parameter can be a value of:
423 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
424 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
425 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
426 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
427 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
428 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
429 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
430 * @retval None.
432 #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
435 * @brief Checks whether the specified LPTIM interrupt is set or not.
436 * @param __HANDLE__ : LPTIM handle.
437 * @param __INTERRUPT__ : LPTIM interrupt to check.
438 * This parameter can be a value of:
439 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
440 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
441 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
442 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
443 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
444 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
445 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
446 * @retval Interrupt status.
449 #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
452 * @brief Enable interrupt on the LPTIM Wake-up Timer associated Exti line.
453 * @retval None
455 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
458 * @brief Disable interrupt on the LPTIM Wake-up Timer associated Exti line.
459 * @retval None
461 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
464 * @brief Enable event on the LPTIM Wake-up Timer associated Exti line.
465 * @retval None.
467 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
470 * @brief Disable event on the LPTIM Wake-up Timer associated Exti line.
471 * @retval None.
473 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
476 * @brief Enable falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
477 * @retval None.
479 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
482 * @brief Disable falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
483 * @retval None.
485 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
488 * @brief Enable rising edge trigger on the LPTIM Wake-up Timer associated Exti line.
489 * @retval None.
491 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
494 * @brief Disable rising edge trigger on the LPTIM Wake-up Timer associated Exti line.
495 * @retval None.
497 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
500 * @brief Enable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
501 * @retval None.
503 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\
504 __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\
505 }while(0)
508 * @brief Disable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
509 * This parameter can be:
510 * @retval None.
512 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\
513 __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\
514 }while(0)
517 * @brief Check whether the LPTIM Wake-up Timer associated Exti line interrupt flag is set or not.
518 * @retval Line Status.
520 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
523 * @brief Clear the LPTIM Wake-up Timer associated Exti line flag.
524 * @retval None.
526 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
529 * @brief Generate a Software interrupt on the LPTIM Wake-up Timer associated Exti line.
530 * @retval None.
532 #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
535 * @}
538 /* Exported functions --------------------------------------------------------*/
539 /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions
540 * @{
543 /* Initialization/de-initialization functions ********************************/
544 HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim);
545 HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim);
547 /* MSP functions *************************************************************/
548 void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim);
549 void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim);
551 /* Start/Stop operation functions *********************************************/
552 /* ################################# PWM Mode ################################*/
553 /* Blocking mode: Polling */
554 HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
555 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim);
556 /* Non-Blocking mode: Interrupt */
557 HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
558 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim);
560 /* ############################# One Pulse Mode ##############################*/
561 /* Blocking mode: Polling */
562 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
563 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim);
564 /* Non-Blocking mode: Interrupt */
565 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
566 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim);
568 /* ############################## Set once Mode ##############################*/
569 /* Blocking mode: Polling */
570 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
571 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim);
572 /* Non-Blocking mode: Interrupt */
573 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
574 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim);
576 /* ############################### Encoder Mode ##############################*/
577 /* Blocking mode: Polling */
578 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
579 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim);
580 /* Non-Blocking mode: Interrupt */
581 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
582 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim);
584 /* ############################# Time out Mode ##############################*/
585 /* Blocking mode: Polling */
586 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
587 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim);
588 /* Non-Blocking mode: Interrupt */
589 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
590 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim);
592 /* ############################## Counter Mode ###############################*/
593 /* Blocking mode: Polling */
594 HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
595 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim);
596 /* Non-Blocking mode: Interrupt */
597 HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
598 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim);
600 /* Reading operation functions ************************************************/
601 uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim);
602 uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim);
603 uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim);
605 /* LPTIM IRQ functions *******************************************************/
606 void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim);
608 /* CallBack functions ********************************************************/
609 void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim);
610 void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim);
611 void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim);
612 void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim);
613 void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim);
614 void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim);
615 void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim);
617 /* Peripheral State functions ************************************************/
618 HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim);
621 * @}
624 /* Private types -------------------------------------------------------------*/
625 /** @defgroup LPTIM_Private_Types LPTIM Private Types
626 * @{
630 * @}
633 /* Private variables ---------------------------------------------------------*/
634 /** @defgroup LPTIM_Private_Variables LPTIM Private Variables
635 * @{
639 * @}
642 /* Private constants ---------------------------------------------------------*/
643 /** @defgroup LPTIM_Private_Constants LPTIM Private Constants
644 * @{
648 * @}
651 /* Private macros ------------------------------------------------------------*/
652 /** @defgroup LPTIM_Private_Macros LPTIM Private Macros
653 * @{
656 #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \
657 ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC))
659 #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \
660 ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \
661 ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \
662 ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \
663 ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \
664 ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \
665 ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \
666 ((__PRESCALER__) == LPTIM_PRESCALER_DIV128))
667 #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1)
669 #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \
670 ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH))
672 #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \
673 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \
674 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \
675 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS))
677 #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \
678 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \
679 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING))
681 #define IS_LPTIM_TRG_SOURCE(__TRIG__) (((__TRIG__) == LPTIM_TRIGSOURCE_SOFTWARE) || \
682 ((__TRIG__) == LPTIM_TRIGSOURCE_0) || \
683 ((__TRIG__) == LPTIM_TRIGSOURCE_1) || \
684 ((__TRIG__) == LPTIM_TRIGSOURCE_2) || \
685 ((__TRIG__) == LPTIM_TRIGSOURCE_3) || \
686 ((__TRIG__) == LPTIM_TRIGSOURCE_4) || \
687 ((__TRIG__) == LPTIM_TRIGSOURCE_5))
689 #define IS_LPTIM_EXT_TRG_POLARITY(__POLAR__) (((__POLAR__) == LPTIM_ACTIVEEDGE_RISING ) || \
690 ((__POLAR__) == LPTIM_ACTIVEEDGE_FALLING ) || \
691 ((__POLAR__) == LPTIM_ACTIVEEDGE_RISING_FALLING ))
693 #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION) || \
694 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \
695 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \
696 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS ))
698 #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \
699 ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD))
701 #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \
702 ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL))
704 #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFFU)
706 #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFU)
708 #define IS_LPTIM_PERIOD(PERIOD) ((PERIOD) <= 0x0000FFFFU)
710 #define IS_LPTIM_PULSE(PULSE) ((PULSE) <= 0x0000FFFFU)
713 * @}
716 /* Private functions ---------------------------------------------------------*/
717 /** @defgroup LPTIM_Private_Functions LPTIM Private Functions
718 * @{
722 * @}
726 * @}
730 * @}
733 #ifdef __cplusplus
735 #endif
737 #endif /* __STM32F7xx_HAL_LPTIM_H */
739 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/