2 ******************************************************************************
3 * @file stm32l0xx_hal_lptim.h
4 * @author MCD Application Team
6 * @date 06-February-2015
7 * @brief Header file of LPTIM HAL module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2015 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 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32L0xx_HAL_LPTIM_H
40 #define __STM32L0xx_HAL_LPTIM_H
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32l0xx_hal_def.h"
49 /** @addtogroup STM32L0xx_HAL_Driver
53 /** @defgroup LPTIM LPTIM (Low power timer)
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup TIM_Exported_Types TIM Exported Types
62 /** @defgroup LPTIM_Clock_Configuration LPTIM Clock configuration structure
66 * @brief LPTIM Clock configuration definition
70 uint32_t Source; /*!< Selects the clock source.
71 This parameter can be a value of @ref LPTIM_Clock_Source */
73 uint32_t Prescaler; /*!< Specifies the counter clock Prescaler.
74 This parameter can be a value of @ref LPTIM_Clock_Prescaler */
76 }LPTIM_ClockConfigTypeDef;
81 /** @defgroup LPTIM_ULPClock_Configuration LPTIM ULP Clock configuration structure
85 * @brief LPTIM ULP Clock configuration definition
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;
105 /** @defgroup LPTIM_Trigger_Configuration LPTIM Trigger configuration structure
109 * @brief LPTIM Trigger configuration structure
113 uint32_t Source; /*!< Selects the Trigger source.
114 This parameter can be a value of @ref LPTIM_Trigger_Source */
116 uint32_t ActiveEdge; /*!< Selects the Trigger active edge.
117 Note: This parameter is used only when an external trigger is used.
118 This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */
120 uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter.
121 Note: This parameter is used only when an external trigger is used.
122 This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */
123 }LPTIM_TriggerConfigTypeDef;
128 /** @defgroup LPTIM_Init_Configuration LPTIM Initialization configuration structure
132 * @brief LPTIM Initialization Structure definition
136 LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */
138 LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */
140 LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */
142 uint32_t OutputPolarity; /*!< Specifies the Output polarity.
143 This parameter can be a value of @ref LPTIM_Output_Polarity */
145 uint32_t UpdateMode; /*!< Specifies whether the update of the autorelaod and the compare
146 values is done immediately or after the end of current period.
147 This parameter can be a value of @ref LPTIM_Updating_Mode */
149 uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event
150 or each external event.
151 This parameter can be a value of @ref LPTIM_Counter_Source */
157 /** @defgroup LPTIM_State_structure LPTIM state definition
161 * @brief HAL LPTIM State structure definition
163 typedef enum __HAL_LPTIM_StateTypeDef
165 HAL_LPTIM_STATE_RESET = 0x00, /*!< Peripheral not yet initialized or disabled */
166 HAL_LPTIM_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
167 HAL_LPTIM_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
168 HAL_LPTIM_STATE_TIMEOUT = 0x03, /*!< Timeout state */
169 HAL_LPTIM_STATE_ERROR = 0x04 /*!< Internal Process is ongoing */
170 }HAL_LPTIM_StateTypeDef;
175 /** @defgroup LPTIM_Handle LPTIM handler
179 * @brief LPTIM handle Structure definition
183 LPTIM_TypeDef *Instance; /*!< Register base address */
185 LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */
187 HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */
189 HAL_LockTypeDef Lock; /*!< LPTIM locking object */
191 __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */
193 }LPTIM_HandleTypeDef;
202 /* Exported constants --------------------------------------------------------*/
204 /** @defgroup LPTIM_Exported_Constants LPTIM Exported constants
208 /* Check autoreload value */
209 #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFF)
211 /* Check compare value */
212 #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFF)
214 /** @defgroup LPTIM_Clock_Source Clock source
217 #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC ((uint32_t)0x00)
218 #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL
222 #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \
223 ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC))
226 /** @defgroup LPTIM_Clock_Prescaler Prescaler
229 #define LPTIM_PRESCALER_DIV1 ((uint32_t)0x000000)
230 #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0
231 #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1
232 #define LPTIM_PRESCALER_DIV8 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1))
233 #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2
234 #define LPTIM_PRESCALER_DIV32 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2))
235 #define LPTIM_PRESCALER_DIV64 ((uint32_t)(LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2))
236 #define LPTIM_PRESCALER_DIV128 ((uint32_t)LPTIM_CFGR_PRESC)
241 #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \
242 ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \
243 ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \
244 ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \
245 ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \
246 ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \
247 ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \
248 ((__PRESCALER__) == LPTIM_PRESCALER_DIV128))
250 #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1)
253 /** @defgroup LPTIM_Output_Polarity Output polarity
256 #define LPTIM_OUTPUTPOLARITY_HIGH ((uint32_t)0x00000000)
257 #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL)
261 #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \
262 ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH))
264 /** @defgroup LPTIM_Clock_Sample_Time Clock sample time
267 #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000)
268 #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0
269 #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1
270 #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT
274 #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \
275 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \
276 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \
277 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS))
279 /** @defgroup LPTIM_Clock_Polarity Clock polarity
282 #define LPTIM_CLOCKPOLARITY_RISING ((uint32_t)0x00000000)
283 #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0
284 #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1
289 #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \
290 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \
291 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING))
293 /** @defgroup LPTIM_External_Trigger_Polarity Trigger polarity
296 #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0
297 #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1
298 #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN
302 #define IS_LPTIM_EXT_TRG_POLARITY(__POLAR__) (((__POLAR__) == LPTIM_ACTIVEEDGE_RISING ) || \
303 ((__POLAR__) == LPTIM_ACTIVEEDGE_FALLING ) || \
304 ((__POLAR__) == LPTIM_ACTIVEEDGE_RISING_FALLING ))
306 /** @defgroup LPTIM_Trigger_Sample_Time Trigger sample time
309 #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000)
310 #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0
311 #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1
312 #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT
316 #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ) || \
317 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \
318 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \
319 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS ))
322 /** @defgroup LPTIM_Updating_Mode Updating mode
326 #define LPTIM_UPDATE_IMMEDIATE ((uint32_t)0x00000000)
327 #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD
331 #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \
332 ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD))
336 /** @defgroup LPTIM_Counter_Source Counter source
339 #define LPTIM_COUNTERSOURCE_INTERNAL ((uint32_t)0x00000000)
340 #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE
344 #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \
345 ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL))
349 /* Check for period value */
350 #define IS_LPTIM_PERIOD(__PERIOD__) ((__PERIOD__) <= 0x0000FFFF)
352 /* Check for pulse value */
353 #define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFF)
355 /** @defgroup LPTIM_Flag_Definition Flag definition
358 #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN
359 #define LPTIM_FLAG_UP LPTIM_ISR_UP
360 #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK
361 #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK
362 #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG
363 #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM
364 #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM
369 /** @defgroup LPTIM_Interrupts_Definition Interrupts definition
372 #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE
373 #define LPTIM_IT_UP LPTIM_IER_UPIE
374 #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE
375 #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE
376 #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE
377 #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE
378 #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE
387 /* Exported macro ------------------------------------------------------------*/
389 /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros
393 /** @brief Reset LPTIM handle state
394 * @param __HANDLE__: LPTIM handle
397 #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET)
400 * @brief Enable/Disable the LPTIM peripheral.
401 * @param __HANDLE__: LPTIM handle
404 #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE))
405 #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE))
408 * @brief Starts the LPTIM peripheral in Continuous or in single mode.
409 * @param __HANDLE__: DMA handle
412 #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT)
413 #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT)
417 * @brief Writes the passed parameter in the Autoreload register.
418 * @param __HANDLE__: LPTIM handle
419 * @param __VALUE__ : Autoreload value
422 #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__))
425 * @brief Writes the passed parameter in the Compare register.
426 * @param __HANDLE__: LPTIM handle
427 * @param __VALUE__ : Compare value
430 #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__))
433 * @brief Checks whether the specified LPTIM flag is set or not.
434 * @param __HANDLE__: LPTIM handle
435 * @param __FLAG__ : LPTIM flag to check
436 * This parameter can be a value of:
437 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
438 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
439 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
440 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
441 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
442 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
443 * @arg LPTIM_FLAG_CMPM : Compare match Flag.
444 * @retval The state of the specified flag (SET or RESET).
446 #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__))
449 * @brief Clears the specified LPTIM flag.
450 * @param __HANDLE__: LPTIM handle.
451 * @param __FLAG__ : LPTIM flag to clear.
452 * This parameter can be a value of:
453 * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
454 * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
455 * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
456 * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
457 * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
458 * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
459 * @arg LPTIM_FLAG_CMPM : Compare match Flag.
462 #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
465 * @brief Enable the specified LPTIM interrupt.
466 * @param __HANDLE__ : LPTIM handle.
467 * @param __INTERRUPT__ : LPTIM interrupt to set.
468 * This parameter can be a value of:
469 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
470 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
471 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
472 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
473 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
474 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
475 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
478 #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
481 * @brief Disable the specified LPTIM interrupt.
482 * @param __HANDLE__ : LPTIM handle.
483 * @param __INTERRUPT__ : LPTIM interrupt to set.
484 * This parameter can be a value of:
485 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
486 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
487 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
488 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
489 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
490 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
491 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
494 #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
497 * @brief Checks whether the specified LPTIM interrupt is set or not.
498 * @param __HANDLE__ : LPTIM handle.
499 * @param __INTERRUPT__ : LPTIM interrupt to check.
500 * This parameter can be a value of:
501 * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
502 * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
503 * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
504 * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
505 * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
506 * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
507 * @arg LPTIM_IT_CMPM : Compare match Interrupt.
508 * @retval Interrupt status.
511 #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
518 /* Include LPTIM HAL Extension module */
519 #include "stm32l0xx_hal_lptim_ex.h"
521 /* Exported functions --------------------------------------------------------*/
523 /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions
526 /* Initialization/de-initialization functions ********************************/
528 /** @defgroup LPTIM_Exported_Functions_Group1 Initialization/de-initialization functions
531 HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim);
532 HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim);
535 /* MSP functions *************************************************************/
537 void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim);
538 void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim);
544 /* Start/Stop operation functions *********************************************/
546 /** @defgroup LPTIM_Exported_Functions_Group2 LPTIM Start-Stop operation functions
550 /* ################################# PWM Mode ################################*/
551 /* Blocking mode: Polling */
552 HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
553 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim);
554 /* Non-Blocking mode: Interrupt */
555 HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
556 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim);
558 /* ############################# One Pulse Mode ##############################*/
559 /* Blocking mode: Polling */
560 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
561 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim);
562 /* Non-Blocking mode: Interrupt */
563 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
564 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim);
566 /* ############################## Set once Mode ##############################*/
567 /* Blocking mode: Polling */
568 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
569 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim);
570 /* Non-Blocking mode: Interrupt */
571 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
572 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim);
574 /* ############################### Encoder Mode ##############################*/
575 /* Blocking mode: Polling */
576 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
577 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim);
578 /* Non-Blocking mode: Interrupt */
579 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
580 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim);
582 /* ############################# Time out Mode ##############################*/
583 /* Blocking mode: Polling */
584 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
585 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim);
586 /* Non-Blocking mode: Interrupt */
587 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
588 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim);
590 /* ############################## Counter Mode ###############################*/
591 /* Blocking mode: Polling */
592 HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
593 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim);
594 /* Non-Blocking mode: Interrupt */
595 HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
596 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim);
602 /* Reading operation functions ************************************************/
604 /** @defgroup LPTIM_Exported_Functions_Group3 LPTIM Read operation functions
607 uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim);
608 uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim);
609 uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim);
614 /* LPTIM IRQ functions *******************************************************/
615 /** @defgroup LPTIM_Exported_Functions_Group4 LPTIM IRQ handler
618 void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim);
620 /* CallBack functions ********************************************************/
621 void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim);
622 void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim);
623 void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim);
624 void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim);
625 void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim);
626 void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim);
627 void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim);
631 /* Peripheral State functions ************************************************/
632 /** @defgroup LPTIM_Exported_Functions_Group5 Peripheral State functions
636 HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim);
658 #endif /* __STM32L0xx_HAL_LPTIM_H */
660 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/