STM32F439xx HAL User Manual
stm32f4xx_hal_lptim.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f4xx_hal_lptim.c
00004   * @author  MCD Application Team
00005   * @brief   LPTIM HAL module driver. 
00006   *          This file provides firmware functions to manage the following 
00007   *          functionalities of the Low Power Timer (LPTIM) peripheral:
00008   *           + Initialization and de-initialization functions.
00009   *           + Start/Stop operation functions in polling mode.
00010   *           + Start/Stop operation functions in interrupt mode.
00011   *           + Reading operation functions.
00012   *           + Peripheral State functions.
00013   *         
00014   @verbatim
00015   ==============================================================================
00016                      ##### How to use this driver #####
00017   ==============================================================================
00018     [..]
00019       The LPTIM HAL driver can be used as follows:
00020 
00021       (#)Initialize the LPTIM low level resources by implementing the
00022         HAL_LPTIM_MspInit():
00023          (##) Enable the LPTIM interface clock using __LPTIMx_CLK_ENABLE().
00024          (##) In case of using interrupts (e.g. HAL_LPTIM_PWM_Start_IT()):
00025              (+++) Configure the LPTIM interrupt priority using HAL_NVIC_SetPriority().
00026              (+++) Enable the LPTIM IRQ handler using HAL_NVIC_EnableIRQ().
00027              (+++) In LPTIM IRQ handler, call HAL_LPTIM_IRQHandler().
00028 
00029       (#)Initialize the LPTIM HAL using HAL_LPTIM_Init(). This function
00030          configures mainly:
00031          (##) The instance: LPTIM1.
00032          (##) Clock: the counter clock.
00033              (+++) Source   : it can be either the ULPTIM input (IN1) or one of
00034                               the internal clock; (APB, LSE or LSI).
00035              (+++) Prescaler: select the clock divider.
00036          (##)  UltraLowPowerClock : To be used only if the ULPTIM is selected
00037                as counter clock source.
00038              (+++) Polarity:   polarity of the active edge for the counter unit
00039                                if the ULPTIM input is selected.
00040              (+++) SampleTime: clock sampling time to configure the clock glitch
00041                                filter.              
00042          (##) Trigger: How the counter start.
00043              (+++) Source: trigger can be software or one of the hardware triggers.
00044              (+++) ActiveEdge : only for hardware trigger.
00045              (+++) SampleTime : trigger sampling time to configure the trigger
00046                                 glitch filter.
00047          (##) OutputPolarity : 2 opposite polarities are possibles.
00048          (##) UpdateMode: specifies whether the update of the autoreload and
00049               the compare values is done immediately or after the end of current
00050               period.   
00051 
00052       (#)Six modes are available:
00053 
00054          (##) PWM Mode: To generate a PWM signal with specified period and pulse,
00055          call HAL_LPTIM_PWM_Start() or HAL_LPTIM_PWM_Start_IT() for interruption
00056          mode.
00057 
00058          (##) One Pulse Mode: To generate pulse with specified width in response
00059          to a stimulus, call HAL_LPTIM_OnePulse_Start() or
00060          HAL_LPTIM_OnePulse_Start_IT() for interruption mode.
00061 
00062          (##) Set once Mode: In this mode, the output changes the level (from
00063          low level to high level if the output polarity is configured high, else
00064          the opposite) when a compare match occurs. To start this mode, call 
00065          HAL_LPTIM_SetOnce_Start() or HAL_LPTIM_SetOnce_Start_IT() for
00066          interruption mode.
00067 
00068          (##) Encoder Mode: To use the encoder interface call
00069          HAL_LPTIM_Encoder_Start() or HAL_LPTIM_Encoder_Start_IT() for 
00070          interruption mode.
00071 
00072          (##) Time out Mode: an active edge on one selected trigger input rests
00073          the counter. The first trigger event will start the timer, any
00074          successive trigger event will reset the counter and the timer will
00075          restart. To start this mode call HAL_LPTIM_TimeOut_Start_IT() or 
00076          HAL_LPTIM_TimeOut_Start_IT() for interruption mode.
00077 
00078          (##) Counter Mode: counter can be used to count external events on
00079          the LPTIM Input1 or it can be used to count internal clock cycles.
00080          To start this mode, call HAL_LPTIM_Counter_Start() or 
00081          HAL_LPTIM_Counter_Start_IT() for interruption mode.
00082 
00083       (#) User can stop any process by calling the corresponding API:
00084           HAL_LPTIM_Xxx_Stop() or HAL_LPTIM_Xxx_Stop_IT() if the process is
00085           already started in interruption mode.
00086 
00087        (#)Call HAL_LPTIM_DeInit() to deinitialize the LPTIM peripheral.
00088 
00089   @endverbatim
00090   ******************************************************************************
00091   * @attention
00092   *
00093   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00094   *
00095   * Redistribution and use in source and binary forms, with or without modification,
00096   * are permitted provided that the following conditions are met:
00097   *   1. Redistributions of source code must retain the above copyright notice,
00098   *      this list of conditions and the following disclaimer.
00099   *   2. Redistributions in binary form must reproduce the above copyright notice,
00100   *      this list of conditions and the following disclaimer in the documentation
00101   *      and/or other materials provided with the distribution.
00102   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00103   *      may be used to endorse or promote products derived from this software
00104   *      without specific prior written permission.
00105   *
00106   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00107   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00108   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00109   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00110   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00111   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00112   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00113   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00114   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00115   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00116   *
00117   ******************************************************************************
00118   */
00119 
00120 /* Includes ------------------------------------------------------------------*/
00121 #include "stm32f4xx_hal.h"
00122 
00123 /** @addtogroup STM32F4xx_HAL_Driver
00124   * @{
00125   */
00126 
00127 /** @defgroup LPTIM LPTIM
00128   * @brief LPTIM HAL module driver.
00129   * @{
00130   */
00131 
00132 #ifdef HAL_LPTIM_MODULE_ENABLED
00133 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx)
00134 /* Private types -------------------------------------------------------------*/
00135 /** @defgroup LPTIM_Private_Types LPTIM Private Types
00136   * @{
00137   */
00138 
00139 /**
00140   * @}
00141   */
00142   
00143 /* Private defines -----------------------------------------------------------*/
00144 /** @defgroup LPTIM_Private_Defines LPTIM Private Defines
00145   * @{
00146   */
00147 
00148 /**
00149   * @}
00150   */
00151 
00152 /* Private variables ---------------------------------------------------------*/
00153 /** @addtogroup LPTIM_Private_Variables LPTIM Private Variables
00154   * @{
00155   */
00156 
00157 /**
00158   * @}
00159   */
00160  
00161 /* Private constants ---------------------------------------------------------*/
00162 /** @addtogroup LPTIM_Private_Constants LPTIM Private Constants
00163   * @{
00164   */
00165 
00166 /**
00167   * @}
00168   */
00169   
00170 /* Private macros ------------------------------------------------------------*/
00171 /** @addtogroup LPTIM_Private_Macros LPTIM Private Macros
00172   * @{
00173   */
00174 
00175 /**
00176   * @}
00177   */
00178 
00179 /* Private function prototypes -----------------------------------------------*/
00180 /** @addtogroup LPTIM_Private_Functions_Prototypes LPTIM Private Functions Prototypes
00181   * @{
00182   */
00183 
00184 /**
00185   * @}
00186   */
00187 
00188 /* Private functions ---------------------------------------------------------*/
00189 /** @addtogroup LPTIM_Private_Functions LPTIM Private Functions
00190   * @{
00191   */
00192 
00193 /**
00194   * @}
00195   */
00196   
00197 /* Exported functions ---------------------------------------------------------*/
00198 /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions
00199   * @{
00200   */
00201 
00202 /** @defgroup LPTIM_Group1 Initialization/de-initialization functions 
00203  *  @brief    Initialization and Configuration functions. 
00204  *
00205 @verbatim
00206   ==============================================================================
00207               ##### Initialization and de-initialization functions #####
00208   ==============================================================================
00209     [..]  This section provides functions allowing to:
00210       (+) Initialize the LPTIM according to the specified parameters in the
00211           LPTIM_InitTypeDef and creates the associated handle.
00212       (+) DeInitialize the LPTIM peripheral.
00213       (+) Initialize the LPTIM MSP.
00214       (+) DeInitialize LPTIM MSP. 
00215  
00216 @endverbatim
00217   * @{
00218   */
00219 
00220 /**
00221   * @brief  Initializes the LPTIM according to the specified parameters in the
00222   *         LPTIM_InitTypeDef and creates the associated handle.
00223   * @param  hlptim LPTIM handle
00224   * @retval HAL status
00225   */
00226 HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim)
00227 {
00228   uint32_t tmpcfgr = 0U;
00229 
00230   /* Check the LPTIM handle allocation */
00231   if(hlptim == NULL)
00232   {
00233     return HAL_ERROR;
00234   }
00235 
00236   /* Check the parameters */
00237   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00238   
00239   assert_param(IS_LPTIM_CLOCK_SOURCE(hlptim->Init.Clock.Source));
00240   assert_param(IS_LPTIM_CLOCK_PRESCALER(hlptim->Init.Clock.Prescaler));  
00241   if ((hlptim->Init.Clock.Source) ==  LPTIM_CLOCKSOURCE_ULPTIM)
00242   {
00243     assert_param(IS_LPTIM_CLOCK_POLARITY(hlptim->Init.UltraLowPowerClock.Polarity));
00244     assert_param(IS_LPTIM_CLOCK_SAMPLE_TIME(hlptim->Init.UltraLowPowerClock.SampleTime));
00245   }  
00246   assert_param(IS_LPTIM_TRG_SOURCE(hlptim->Init.Trigger.Source));
00247   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00248   {
00249     assert_param(IS_LPTIM_TRIG_SAMPLE_TIME(hlptim->Init.Trigger.SampleTime));
00250     assert_param(IS_LPTIM_EXT_TRG_POLARITY(hlptim->Init.Trigger.ActiveEdge));
00251   }  
00252   assert_param(IS_LPTIM_OUTPUT_POLARITY(hlptim->Init.OutputPolarity));  
00253   assert_param(IS_LPTIM_UPDATE_MODE(hlptim->Init.UpdateMode));
00254   assert_param(IS_LPTIM_COUNTER_SOURCE(hlptim->Init.CounterSource));
00255   
00256   if(hlptim->State == HAL_LPTIM_STATE_RESET)
00257   {
00258     /* Allocate lock resource and initialize it */
00259     hlptim->Lock = HAL_UNLOCKED;
00260     /* Init the low level hardware */
00261     HAL_LPTIM_MspInit(hlptim);
00262   }
00263   
00264   /* Change the LPTIM state */
00265   hlptim->State = HAL_LPTIM_STATE_BUSY;
00266   
00267   /* Get the LPTIMx CFGR value */
00268   tmpcfgr = hlptim->Instance->CFGR;
00269   
00270   if ((hlptim->Init.Clock.Source) ==  LPTIM_CLOCKSOURCE_ULPTIM)
00271   {
00272     tmpcfgr &= (uint32_t)(~(LPTIM_CFGR_CKPOL | LPTIM_CFGR_CKFLT));
00273   }
00274   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00275   {
00276     tmpcfgr &= (uint32_t)(~ (LPTIM_CFGR_TRGFLT | LPTIM_CFGR_TRIGSEL));
00277   }
00278     
00279   /* Clear CKSEL, PRESC, TRIGEN, TRGFLT, WAVPOL, PRELOAD & COUNTMODE bits */
00280   tmpcfgr &= (uint32_t)(~(LPTIM_CFGR_CKSEL | LPTIM_CFGR_TRIGEN | LPTIM_CFGR_PRELOAD |
00281                           LPTIM_CFGR_WAVPOL | LPTIM_CFGR_PRESC | LPTIM_CFGR_COUNTMODE ));
00282   
00283   /* Set initialization parameters */
00284   tmpcfgr |= (hlptim->Init.Clock.Source    |
00285               hlptim->Init.Clock.Prescaler |
00286               hlptim->Init.OutputPolarity  |
00287               hlptim->Init.UpdateMode      |
00288               hlptim->Init.CounterSource);
00289   
00290   if ((hlptim->Init.Clock.Source) ==  LPTIM_CLOCKSOURCE_ULPTIM)
00291   {
00292     tmpcfgr |=  (hlptim->Init.UltraLowPowerClock.Polarity |
00293                 hlptim->Init.UltraLowPowerClock.SampleTime);
00294   } 
00295   
00296   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00297   {
00298     /* Enable External trigger and set the trigger source */
00299     tmpcfgr |= (hlptim->Init.Trigger.Source     |
00300                 hlptim->Init.Trigger.ActiveEdge |
00301                 hlptim->Init.Trigger.SampleTime);
00302   }
00303   
00304   /* Write to LPTIMx CFGR */
00305   hlptim->Instance->CFGR = tmpcfgr;
00306 
00307   /* Change the LPTIM state */
00308   hlptim->State = HAL_LPTIM_STATE_READY;
00309   
00310   /* Return function status */
00311   return HAL_OK;
00312 }
00313 
00314 /**
00315   * @brief  DeInitializes the LPTIM peripheral. 
00316   * @param  hlptim LPTIM handle
00317   * @retval HAL status
00318   */
00319 HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim)
00320 {
00321   /* Check the LPTIM handle allocation */
00322   if(hlptim == NULL)
00323   {
00324     return HAL_ERROR;
00325   }
00326   
00327   /* Change the LPTIM state */
00328   hlptim->State = HAL_LPTIM_STATE_BUSY;
00329   
00330   /* Disable the LPTIM Peripheral Clock */
00331   __HAL_LPTIM_DISABLE(hlptim);
00332   
00333   /* DeInit the low level hardware: CLOCK, NVIC.*/
00334   HAL_LPTIM_MspDeInit(hlptim);
00335   
00336   /* Change the LPTIM state */
00337   hlptim->State = HAL_LPTIM_STATE_RESET;
00338   
00339   /* Release Lock */
00340   __HAL_UNLOCK(hlptim);
00341   
00342   /* Return function status */
00343   return HAL_OK;
00344 }
00345 
00346 /**
00347   * @brief  Initializes the LPTIM MSP.
00348   * @param  hlptim LPTIM handle
00349   * @retval None
00350   */
00351 __weak void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim)
00352 {
00353   /* Prevent unused argument(s) compilation warning */
00354   UNUSED(hlptim);
00355   /* NOTE : This function Should not be modified, when the callback is needed,
00356             the HAL_LPTIM_MspInit could be implemented in the user file
00357    */
00358 }
00359 
00360 /**
00361   * @brief  DeInitializes LPTIM MSP.
00362   * @param  hlptim LPTIM handle
00363   * @retval None
00364   */
00365 __weak void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim)
00366 {
00367   /* Prevent unused argument(s) compilation warning */
00368   UNUSED(hlptim);
00369   /* NOTE : This function Should not be modified, when the callback is needed,
00370             the HAL_LPTIM_MspDeInit could be implemented in the user file
00371    */
00372 }
00373 
00374 /**
00375   * @}
00376   */
00377 
00378 /** @defgroup LPTIM_Group2 LPTIM Start-Stop operation functions 
00379  *  @brief   Start-Stop operation functions. 
00380  *
00381 @verbatim   
00382   ==============================================================================
00383                 ##### LPTIM Start Stop operation functions #####
00384   ==============================================================================
00385     [..]  This section provides functions allowing to:
00386       (+) Start the PWM mode.
00387       (+) Stop the PWM mode.
00388       (+) Start the One pulse mode.
00389       (+) Stop the One pulse mode.
00390       (+) Start the Set once mode.
00391       (+) Stop the Set once mode.
00392       (+) Start the Encoder mode.
00393       (+) Stop the Encoder mode.
00394       (+) Start the Timeout mode.
00395       (+) Stop the Timeout mode.      
00396       (+) Start the Counter mode.
00397       (+) Stop the Counter mode.
00398       
00399 
00400 @endverbatim
00401   * @{
00402   */
00403     
00404 /**
00405   * @brief  Starts the LPTIM PWM generation.
00406   * @param  hlptim  LPTIM handle
00407   * @param  Period  Specifies the Autoreload value.
00408   *         This parameter must be a value between 0x0000 and 0xFFFF.
00409   * @param  Pulse  Specifies the compare value.
00410   *         This parameter must be a value between 0x0000 and 0xFFFF.
00411   * @retval HAL status
00412   */
00413 HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00414 {
00415   /* Check the parameters */
00416   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00417   assert_param(IS_LPTIM_PERIOD(Period));
00418   assert_param(IS_LPTIM_PULSE(Pulse));
00419                
00420   /* Set the LPTIM state */
00421   hlptim->State= HAL_LPTIM_STATE_BUSY;
00422  
00423   /* Reset WAVE bit to set PWM mode */
00424   hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
00425   
00426   /* Enable the Peripheral */
00427   __HAL_LPTIM_ENABLE(hlptim);
00428   
00429   /* Load the period value in the autoreload register */
00430   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00431   
00432   /* Load the pulse value in the compare register */
00433   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00434   
00435   /* Start timer in continuous mode */
00436   __HAL_LPTIM_START_CONTINUOUS(hlptim);
00437     
00438   /* Change the TIM state*/
00439   hlptim->State= HAL_LPTIM_STATE_READY;
00440   
00441   /* Return function status */
00442   return HAL_OK;
00443 }
00444 
00445 /**
00446   * @brief  Stops the LPTIM PWM generation.
00447   * @param  hlptim  LPTIM handle
00448   * @retval HAL status
00449   */
00450 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim)
00451 {
00452   /* Check the parameters */
00453   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00454                
00455   /* Set the LPTIM state */
00456   hlptim->State= HAL_LPTIM_STATE_BUSY;
00457   
00458   /* Disable the Peripheral */
00459   __HAL_LPTIM_DISABLE(hlptim);
00460 
00461   /* Change the TIM state*/
00462   hlptim->State= HAL_LPTIM_STATE_READY;
00463   
00464   /* Return function status */
00465   return HAL_OK;
00466 }
00467 
00468 /**
00469   * @brief  Starts the LPTIM PWM generation in interrupt mode.
00470   * @param  hlptim  LPTIM handle
00471   * @param  Period  Specifies the Autoreload value.
00472   *         This parameter must be a value between 0x0000 and 0xFFFF
00473   * @param  Pulse  Specifies the compare value.
00474   *         This parameter must be a value between 0x0000 and 0xFFFF
00475   * @retval HAL status
00476   */
00477 HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00478 {
00479   /* Check the parameters */
00480   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00481   assert_param(IS_LPTIM_PERIOD(Period));
00482   assert_param(IS_LPTIM_PULSE(Pulse));
00483                
00484   /* Set the LPTIM state */
00485   hlptim->State= HAL_LPTIM_STATE_BUSY;
00486  
00487   /* Reset WAVE bit to set PWM mode */
00488   hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
00489   
00490   /* Enable Autoreload write complete interrupt */
00491   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
00492   
00493   /* Enable Compare write complete interrupt */
00494   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
00495   
00496   /* Enable Autoreload match interrupt */
00497   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
00498   
00499   /* Enable Compare match interrupt */
00500   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
00501   
00502   /* If external trigger source is used, then enable external trigger interrupt */
00503   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00504   {
00505     /* Enable external trigger interrupt */
00506     __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00507   }  
00508   
00509   /* Enable the Peripheral */
00510   __HAL_LPTIM_ENABLE(hlptim);
00511   
00512   /* Load the period value in the autoreload register */
00513   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00514   
00515   /* Load the pulse value in the compare register */
00516   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00517   
00518   /* Start timer in continuous mode */
00519   __HAL_LPTIM_START_CONTINUOUS(hlptim);
00520     
00521   /* Change the TIM state*/
00522   hlptim->State= HAL_LPTIM_STATE_READY;
00523   
00524   /* Return function status */
00525   return HAL_OK;
00526 }
00527 
00528 /**
00529   * @brief  Stops the LPTIM PWM generation in interrupt mode.
00530   * @param  hlptim  LPTIM handle
00531   * @retval HAL status
00532   */
00533 HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim)
00534 {
00535   /* Check the parameters */
00536   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00537                
00538   /* Set the LPTIM state */
00539   hlptim->State= HAL_LPTIM_STATE_BUSY;
00540   
00541   /* Disable the Peripheral */
00542   __HAL_LPTIM_DISABLE(hlptim);
00543   
00544     /* Disable Autoreload write complete interrupt */
00545   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
00546   
00547   /* Disable Compare write complete interrupt */
00548   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
00549   
00550   /* Disable Autoreload match interrupt */
00551   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
00552   
00553   /* Disable Compare match interrupt */
00554   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
00555   
00556   /* If external trigger source is used, then disable external trigger interrupt */
00557   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00558   {
00559     /* Disable external trigger interrupt */
00560     __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00561   }  
00562 
00563   /* Change the TIM state*/
00564   hlptim->State= HAL_LPTIM_STATE_READY;
00565   
00566   /* Return function status */
00567   return HAL_OK;
00568 }
00569 
00570 /**
00571   * @brief  Starts the LPTIM One pulse generation.
00572   * @param  hlptim  LPTIM handle
00573   * @param  Period  Specifies the Autoreload value.
00574   *         This parameter must be a value between 0x0000 and 0xFFFF.
00575   * @param  Pulse  Specifies the compare value.
00576   *         This parameter must be a value between 0x0000 and 0xFFFF.
00577   * @retval HAL status
00578   */
00579 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00580 {
00581   /* Check the parameters */
00582   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00583   assert_param(IS_LPTIM_PERIOD(Period));
00584   assert_param(IS_LPTIM_PULSE(Pulse));
00585                
00586   /* Set the LPTIM state */
00587   hlptim->State= HAL_LPTIM_STATE_BUSY;
00588   
00589   /* Reset WAVE bit to set one pulse mode */
00590   hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
00591   
00592   /* Enable the Peripheral */
00593   __HAL_LPTIM_ENABLE(hlptim);
00594   
00595   /* Load the period value in the autoreload register */
00596   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00597   
00598   /* Load the pulse value in the compare register */
00599   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00600   
00601   /* Start timer in continuous mode */
00602   __HAL_LPTIM_START_SINGLE(hlptim);
00603     
00604   /* Change the TIM state*/
00605   hlptim->State= HAL_LPTIM_STATE_READY;
00606   
00607   /* Return function status */
00608   return HAL_OK;
00609 }
00610 
00611 /**
00612   * @brief  Stops the LPTIM One pulse generation.
00613   * @param  hlptim  LPTIM handle
00614   * @retval HAL status
00615   */
00616 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim)
00617 {
00618   /* Check the parameters */
00619   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00620                
00621   /* Set the LPTIM state */
00622   hlptim->State= HAL_LPTIM_STATE_BUSY;
00623   
00624   /* Disable the Peripheral */
00625   __HAL_LPTIM_DISABLE(hlptim);
00626 
00627   /* Change the TIM state*/
00628   hlptim->State= HAL_LPTIM_STATE_READY;
00629   
00630   /* Return function status */
00631   return HAL_OK;
00632 }
00633 
00634 /**
00635   * @brief  Starts the LPTIM One pulse generation in interrupt mode.
00636   * @param  hlptim  LPTIM handle
00637   * @param  Period  Specifies the Autoreload value.
00638   *         This parameter must be a value between 0x0000 and 0xFFFF.
00639   * @param  Pulse  Specifies the compare value.
00640   *         This parameter must be a value between 0x0000 and 0xFFFF.
00641   * @retval HAL status
00642   */
00643 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00644 {
00645   /* Check the parameters */
00646   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00647   assert_param(IS_LPTIM_PERIOD(Period));
00648   assert_param(IS_LPTIM_PULSE(Pulse));
00649                
00650   /* Set the LPTIM state */
00651   hlptim->State= HAL_LPTIM_STATE_BUSY;
00652   
00653   /* Reset WAVE bit to set one pulse mode */
00654   hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
00655   
00656   /* Enable Autoreload write complete interrupt */
00657   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
00658   
00659   /* Enable Compare write complete interrupt */
00660   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
00661   
00662   /* Enable Autoreload match interrupt */
00663   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
00664   
00665   /* Enable Compare match interrupt */
00666   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
00667   
00668   /* If external trigger source is used, then enable external trigger interrupt */
00669   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00670   {
00671     /* Enable external trigger interrupt */
00672     __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00673   }
00674   
00675   /* Enable the Peripheral */
00676   __HAL_LPTIM_ENABLE(hlptim);
00677   
00678   /* Load the period value in the autoreload register */
00679   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00680   
00681   /* Load the pulse value in the compare register */
00682   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00683   
00684   /* Start timer in continuous mode */
00685   __HAL_LPTIM_START_SINGLE(hlptim);
00686     
00687   /* Change the TIM state*/
00688   hlptim->State= HAL_LPTIM_STATE_READY;
00689   
00690   /* Return function status */
00691   return HAL_OK;
00692 }
00693 
00694 /**
00695   * @brief  Stops the LPTIM One pulse generation in interrupt mode.
00696   * @param  hlptim  LPTIM handle
00697   * @retval HAL status
00698   */
00699 HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim)
00700 {
00701   /* Check the parameters */
00702   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00703                
00704   /* Set the LPTIM state */
00705   hlptim->State= HAL_LPTIM_STATE_BUSY;
00706   
00707   /* Disable the Peripheral */
00708   __HAL_LPTIM_DISABLE(hlptim);
00709   
00710   /* Disable Autoreload write complete interrupt */
00711   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
00712   
00713   /* Disable Compare write complete interrupt */
00714   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
00715   
00716   /* Disable Autoreload match interrupt */
00717   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
00718   
00719   /* Disable Compare match interrupt */
00720   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
00721   
00722   /* If external trigger source is used, then disable external trigger interrupt */
00723   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00724   {
00725     /* Disable external trigger interrupt */
00726     __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00727   }
00728   
00729   /* Change the TIM state*/
00730   hlptim->State= HAL_LPTIM_STATE_READY;
00731   
00732   /* Return function status */
00733   return HAL_OK;
00734 }
00735 
00736 /**
00737   * @brief  Starts the LPTIM in Set once mode.
00738   * @param  hlptim  LPTIM handle
00739   * @param  Period  Specifies the Autoreload value.
00740   *         This parameter must be a value between 0x0000 and 0xFFFF.
00741   * @param  Pulse  Specifies the compare value.
00742   *         This parameter must be a value between 0x0000 and 0xFFFF.
00743   * @retval HAL status
00744   */
00745 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00746 {
00747   /* Check the parameters */
00748   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00749   assert_param(IS_LPTIM_PERIOD(Period));
00750   assert_param(IS_LPTIM_PULSE(Pulse));
00751                
00752   /* Set the LPTIM state */
00753   hlptim->State= HAL_LPTIM_STATE_BUSY;
00754   
00755   /* Set WAVE bit to enable the set once mode */
00756   hlptim->Instance->CFGR |= LPTIM_CFGR_WAVE;
00757   
00758   /* Enable the Peripheral */
00759   __HAL_LPTIM_ENABLE(hlptim);
00760   
00761   /* Load the period value in the autoreload register */
00762   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00763   
00764   /* Load the pulse value in the compare register */
00765   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00766   
00767   /* Start timer in single mode */
00768   __HAL_LPTIM_START_SINGLE(hlptim);
00769     
00770   /* Change the TIM state*/
00771   hlptim->State= HAL_LPTIM_STATE_READY;
00772   
00773   /* Return function status */
00774   return HAL_OK;
00775 }
00776 
00777 /**
00778   * @brief  Stops the LPTIM Set once mode.
00779   * @param  hlptim  LPTIM handle
00780   * @retval HAL status
00781   */
00782 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim)
00783 {
00784   /* Check the parameters */
00785   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00786                
00787   /* Set the LPTIM state */
00788   hlptim->State= HAL_LPTIM_STATE_BUSY;
00789   
00790   /* Disable the Peripheral */
00791   __HAL_LPTIM_DISABLE(hlptim);
00792 
00793   /* Change the TIM state*/
00794   hlptim->State= HAL_LPTIM_STATE_READY;
00795   
00796   /* Return function status */
00797   return HAL_OK;
00798 }
00799 
00800 /**
00801   * @brief  Starts the LPTIM Set once mode in interrupt mode.
00802   * @param  hlptim  LPTIM handle
00803   * @param  Period  Specifies the Autoreload value.
00804   *         This parameter must be a value between 0x0000 and 0xFFFF.
00805   * @param  Pulse  Specifies the compare value.
00806   *         This parameter must be a value between 0x0000 and 0xFFFF.
00807   * @retval HAL status
00808   */
00809 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
00810 {
00811   /* Check the parameters */
00812   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00813   assert_param(IS_LPTIM_PERIOD(Period));
00814   assert_param(IS_LPTIM_PULSE(Pulse));
00815                
00816   /* Set the LPTIM state */
00817   hlptim->State= HAL_LPTIM_STATE_BUSY;
00818   
00819   /* Set WAVE bit to enable the set once mode */
00820   hlptim->Instance->CFGR |= LPTIM_CFGR_WAVE;
00821   
00822   /* Enable Autoreload write complete interrupt */
00823   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
00824   
00825   /* Enable Compare write complete interrupt */
00826   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
00827   
00828   /* Enable Autoreload match interrupt */
00829   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
00830   
00831   /* Enable Compare match interrupt */
00832   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
00833   
00834   /* If external trigger source is used, then enable external trigger interrupt */
00835   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00836   {
00837     /* Enable external trigger interrupt */
00838     __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00839   }  
00840   
00841   /* Enable the Peripheral */
00842   __HAL_LPTIM_ENABLE(hlptim);
00843   
00844   /* Load the period value in the autoreload register */
00845   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00846   
00847   /* Load the pulse value in the compare register */
00848   __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
00849   
00850   /* Start timer in single mode */
00851   __HAL_LPTIM_START_SINGLE(hlptim);
00852     
00853   /* Change the TIM state*/
00854   hlptim->State= HAL_LPTIM_STATE_READY;
00855   
00856   /* Return function status */
00857   return HAL_OK;
00858 }
00859 
00860 /**
00861   * @brief  Stops the LPTIM Set once mode in interrupt mode.
00862   * @param  hlptim  LPTIM handle
00863   * @retval HAL status
00864   */
00865 HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim)
00866 {
00867   /* Check the parameters */
00868   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00869                
00870   /* Set the LPTIM state */
00871   hlptim->State= HAL_LPTIM_STATE_BUSY;
00872   
00873   /* Disable the Peripheral */
00874   __HAL_LPTIM_DISABLE(hlptim);
00875 
00876   /* Disable Autoreload write complete interrupt */
00877   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
00878   
00879   /* Disable Compare write complete interrupt */
00880   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
00881   
00882   /* Disable Autoreload match interrupt */
00883   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
00884   
00885   /* Disable Compare match interrupt */
00886   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
00887   
00888   /* If external trigger source is used, then disable external trigger interrupt */
00889   if ((hlptim->Init.Trigger.Source) !=  LPTIM_TRIGSOURCE_SOFTWARE)
00890   {
00891     /* Disable external trigger interrupt */
00892     __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
00893   } 
00894   
00895   /* Change the TIM state*/
00896   hlptim->State= HAL_LPTIM_STATE_READY;
00897   
00898   /* Return function status */
00899   return HAL_OK;
00900 }
00901 
00902 /**
00903   * @brief  Starts the Encoder interface.
00904   * @param  hlptim  LPTIM handle
00905   * @param  Period  Specifies the Autoreload value.
00906   *         This parameter must be a value between 0x0000 and 0xFFFF.
00907   * @retval HAL status
00908   */
00909 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period)
00910 {
00911   uint32_t tmpcfgr = 0U;
00912 
00913   /* Check the parameters */
00914   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00915   assert_param(IS_LPTIM_PERIOD(Period));
00916   assert_param(hlptim->Init.Clock.Source == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC);
00917   assert_param(hlptim->Init.Clock.Prescaler == LPTIM_PRESCALER_DIV1);
00918   assert_param(IS_LPTIM_CLOCK_POLARITY(hlptim->Init.UltraLowPowerClock.Polarity));
00919 
00920   /* Set the LPTIM state */
00921   hlptim->State= HAL_LPTIM_STATE_BUSY;
00922 
00923   /* Get the LPTIMx CFGR value */
00924   tmpcfgr = hlptim->Instance->CFGR;
00925 
00926   /* Clear CKPOL bits */
00927   tmpcfgr &= (uint32_t)(~LPTIM_CFGR_CKPOL);
00928 
00929   /* Set Input polarity */
00930   tmpcfgr |=  hlptim->Init.UltraLowPowerClock.Polarity;
00931 
00932   /* Write to LPTIMx CFGR */
00933   hlptim->Instance->CFGR = tmpcfgr;
00934 
00935   /* Set ENC bit to enable the encoder interface */
00936   hlptim->Instance->CFGR |= LPTIM_CFGR_ENC;
00937 
00938   /* Enable the Peripheral */
00939   __HAL_LPTIM_ENABLE(hlptim);
00940 
00941   /* Load the period value in the autoreload register */
00942   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
00943 
00944   /* Start timer in continuous mode */
00945   __HAL_LPTIM_START_CONTINUOUS(hlptim);
00946 
00947   /* Change the TIM state*/
00948   hlptim->State= HAL_LPTIM_STATE_READY;
00949 
00950   /* Return function status */
00951   return HAL_OK;
00952 }
00953 
00954 /**
00955   * @brief  Stops the Encoder interface.
00956   * @param  hlptim  LPTIM handle
00957   * @retval HAL status
00958   */
00959 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim)
00960 {
00961   /* Check the parameters */
00962   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00963                
00964   /* Set the LPTIM state */
00965   hlptim->State= HAL_LPTIM_STATE_BUSY;
00966   
00967   /* Disable the Peripheral */
00968   __HAL_LPTIM_DISABLE(hlptim);
00969   
00970   /* Reset ENC bit to disable the encoder interface */
00971   hlptim->Instance->CFGR &= ~LPTIM_CFGR_ENC;
00972   
00973   /* Change the TIM state*/
00974   hlptim->State= HAL_LPTIM_STATE_READY;
00975   
00976   /* Return function status */
00977   return HAL_OK;
00978 }
00979 
00980 /**
00981   * @brief  Starts the Encoder interface in interrupt mode.
00982   * @param  hlptim  LPTIM handle
00983   * @param  Period  Specifies the Autoreload value.
00984   *         This parameter must be a value between 0x0000 and 0xFFFF.
00985   * @retval HAL status
00986   */
00987 HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period)
00988 {
00989   uint32_t tmpcfgr = 0U;
00990 
00991   /* Check the parameters */
00992   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
00993   assert_param(IS_LPTIM_PERIOD(Period));
00994   assert_param(hlptim->Init.Clock.Source == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC);
00995   assert_param(hlptim->Init.Clock.Prescaler == LPTIM_PRESCALER_DIV1);
00996   assert_param(IS_LPTIM_CLOCK_POLARITY(hlptim->Init.UltraLowPowerClock.Polarity));
00997 
00998   /* Set the LPTIM state */
00999   hlptim->State= HAL_LPTIM_STATE_BUSY;
01000 
01001   /* Configure edge sensitivity for encoder mode */
01002   /* Get the LPTIMx CFGR value */
01003   tmpcfgr = hlptim->Instance->CFGR;
01004 
01005   /* Clear CKPOL bits */
01006   tmpcfgr &= (uint32_t)(~LPTIM_CFGR_CKPOL);
01007 
01008   /* Set Input polarity */
01009   tmpcfgr |=  hlptim->Init.UltraLowPowerClock.Polarity;
01010 
01011   /* Write to LPTIMx CFGR */
01012   hlptim->Instance->CFGR = tmpcfgr;
01013 
01014   /* Set ENC bit to enable the encoder interface */
01015   hlptim->Instance->CFGR |= LPTIM_CFGR_ENC;
01016 
01017   /* Enable "switch to down direction" interrupt */
01018   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_DOWN);
01019 
01020   /* Enable "switch to up direction" interrupt */
01021   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_UP);  
01022 
01023   /* Enable the Peripheral */
01024   __HAL_LPTIM_ENABLE(hlptim);
01025 
01026   /* Load the period value in the autoreload register */
01027   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
01028 
01029   /* Start timer in continuous mode */
01030   __HAL_LPTIM_START_CONTINUOUS(hlptim);
01031 
01032   /* Change the TIM state*/
01033   hlptim->State= HAL_LPTIM_STATE_READY;
01034 
01035   /* Return function status */
01036   return HAL_OK;
01037 }
01038 
01039 /**
01040   * @brief  Stops the Encoder interface in interrupt mode.
01041   * @param  hlptim  LPTIM handle
01042   * @retval HAL status
01043   */
01044 HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim)
01045 {
01046   /* Check the parameters */
01047   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01048                
01049   /* Set the LPTIM state */
01050   hlptim->State= HAL_LPTIM_STATE_BUSY;
01051   
01052   /* Disable the Peripheral */
01053   __HAL_LPTIM_DISABLE(hlptim);
01054   
01055   /* Reset ENC bit to disable the encoder interface */
01056   hlptim->Instance->CFGR &= ~LPTIM_CFGR_ENC;
01057   
01058   /* Disable "switch to down direction" interrupt */
01059   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_DOWN);
01060   
01061   /* Disable "switch to up direction" interrupt */
01062   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_UP); 
01063   
01064   /* Change the TIM state*/
01065   hlptim->State= HAL_LPTIM_STATE_READY;
01066   
01067   /* Return function status */
01068   return HAL_OK;
01069 }
01070 
01071 /**
01072   * @brief  Starts the Timeout function. The first trigger event will start the
01073   *         timer, any successive trigger event will reset the counter and
01074   *         the timer restarts.
01075   * @param  hlptim  LPTIM handle
01076   * @param  Period  Specifies the Autoreload value.
01077   *         This parameter must be a value between 0x0000 and 0xFFFF.
01078   * @param  Timeout  Specifies the TimeOut value to rest the counter.
01079   *         This parameter must be a value between 0x0000 and 0xFFFF.
01080   * @retval HAL status
01081   */
01082 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout)
01083 {
01084   /* Check the parameters */
01085   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01086   assert_param(IS_LPTIM_PERIOD(Period));
01087   assert_param(IS_LPTIM_PULSE(Timeout));
01088                
01089   /* Set the LPTIM state */
01090   hlptim->State= HAL_LPTIM_STATE_BUSY;
01091  
01092   /* Set TIMOUT bit to enable the timeout function */
01093   hlptim->Instance->CFGR |= LPTIM_CFGR_TIMOUT;
01094   
01095   /* Enable the Peripheral */
01096   __HAL_LPTIM_ENABLE(hlptim);
01097   
01098   /* Load the period value in the autoreload register */
01099   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
01100   
01101   /* Load the Timeout value in the compare register */
01102   __HAL_LPTIM_COMPARE_SET(hlptim, Timeout);
01103   
01104   /* Start timer in continuous mode */
01105   __HAL_LPTIM_START_CONTINUOUS(hlptim);
01106     
01107   /* Change the TIM state*/
01108   hlptim->State= HAL_LPTIM_STATE_READY;
01109   
01110   /* Return function status */
01111   return HAL_OK;
01112 }
01113 
01114 /**
01115   * @brief  Stops the Timeout function.
01116   * @param  hlptim  LPTIM handle
01117   * @retval HAL status
01118   */
01119 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim)
01120 {
01121   /* Check the parameters */
01122   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01123   
01124   /* Set the LPTIM state */
01125   hlptim->State= HAL_LPTIM_STATE_BUSY;
01126   
01127   /* Disable the Peripheral */
01128   __HAL_LPTIM_DISABLE(hlptim);
01129   
01130   /* Reset TIMOUT bit to enable the timeout function */
01131   hlptim->Instance->CFGR &= ~LPTIM_CFGR_TIMOUT;
01132   
01133   /* Change the TIM state*/
01134   hlptim->State= HAL_LPTIM_STATE_READY;
01135   
01136   /* Return function status */
01137   return HAL_OK;
01138 }
01139 
01140 /**
01141   * @brief  Starts the Timeout function in interrupt mode. The first trigger 
01142   *         event will start the timer, any successive trigger event will reset
01143   *         the counter and the timer restarts.
01144   * @param  hlptim  LPTIM handle
01145   * @param  Period  Specifies the Autoreload value.
01146   *         This parameter must be a value between 0x0000 and 0xFFFF.
01147   * @param  Timeout  Specifies the TimeOut value to rest the counter.
01148   *         This parameter must be a value between 0x0000 and 0xFFFF.
01149   * @retval HAL status
01150   */
01151 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout)
01152 {
01153   /* Check the parameters */
01154   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01155   assert_param(IS_LPTIM_PERIOD(Period));
01156   assert_param(IS_LPTIM_PULSE(Timeout));
01157                
01158   /* Set the LPTIM state */
01159   hlptim->State= HAL_LPTIM_STATE_BUSY;
01160  
01161   /* Enable EXTI Line interrupt on the LPTIM Wake-up Timer */
01162   __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT(); 
01163   
01164   /* Enable rising edge trigger on the LPTIM Wake-up Timer Exti line */
01165   __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();
01166  
01167   /* Set TIMOUT bit to enable the timeout function */
01168   hlptim->Instance->CFGR |= LPTIM_CFGR_TIMOUT;
01169   
01170   /* Enable Compare match interrupt */
01171   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
01172   
01173   /* Enable the Peripheral */
01174   __HAL_LPTIM_ENABLE(hlptim);
01175   
01176   /* Load the period value in the autoreload register */
01177   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
01178   
01179   /* Load the Timeout value in the compare register */
01180   __HAL_LPTIM_COMPARE_SET(hlptim, Timeout);
01181   
01182   /* Start timer in continuous mode */
01183   __HAL_LPTIM_START_CONTINUOUS(hlptim);
01184     
01185   /* Change the TIM state*/
01186   hlptim->State= HAL_LPTIM_STATE_READY;
01187   
01188   /* Return function status */
01189   return HAL_OK;
01190 }
01191 
01192 /**
01193   * @brief  Stops the Timeout function in interrupt mode.
01194   * @param  hlptim  LPTIM handle
01195   * @retval HAL status
01196   */
01197 HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim)
01198 {
01199   /* Check the parameters */
01200   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01201   
01202   /* Set the LPTIM state */
01203   hlptim->State= HAL_LPTIM_STATE_BUSY;
01204   
01205   /* Disable rising edge trigger on the LPTIM Wake-up Timer Exti line */ 
01206   __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();
01207   
01208   /* Disable EXTI Line interrupt on the LPTIM Wake-up Timer */
01209   __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT(); 
01210   
01211   /* Disable the Peripheral */
01212   __HAL_LPTIM_DISABLE(hlptim);
01213   
01214   /* Reset TIMOUT bit to enable the timeout function */
01215   hlptim->Instance->CFGR &= ~LPTIM_CFGR_TIMOUT;
01216   
01217   /* Disable Compare match interrupt */
01218   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
01219   
01220   /* Change the TIM state*/
01221   hlptim->State= HAL_LPTIM_STATE_READY;
01222   
01223   /* Return function status */
01224   return HAL_OK;
01225 }
01226 
01227 /**
01228   * @brief  Starts the Counter mode.
01229   * @param  hlptim  LPTIM handle
01230   * @param  Period  Specifies the Autoreload value.
01231   *         This parameter must be a value between 0x0000 and 0xFFFF.
01232   * @retval HAL status
01233   */
01234 HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period)
01235 {
01236   /* Check the parameters */
01237   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01238   assert_param(IS_LPTIM_PERIOD(Period));
01239                
01240   /* Set the LPTIM state */
01241   hlptim->State= HAL_LPTIM_STATE_BUSY;
01242   
01243   /* If clock source is not ULPTIM clock and counter source is external, then it must not be prescaled */
01244   if((hlptim->Init.Clock.Source != LPTIM_CLOCKSOURCE_ULPTIM) && (hlptim->Init.CounterSource == LPTIM_COUNTERSOURCE_EXTERNAL))
01245   {
01246     /* Check if clock is prescaled */
01247     assert_param(IS_LPTIM_CLOCK_PRESCALERDIV1(hlptim->Init.Clock.Prescaler));
01248     /* Set clock prescaler to 0 */
01249     hlptim->Instance->CFGR &= ~LPTIM_CFGR_PRESC;
01250   }
01251 
01252   /* Enable the Peripheral */
01253   __HAL_LPTIM_ENABLE(hlptim);
01254   
01255   /* Load the period value in the autoreload register */
01256   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
01257   
01258   /* Start timer in continuous mode */
01259   __HAL_LPTIM_START_CONTINUOUS(hlptim);
01260     
01261   /* Change the TIM state*/
01262   hlptim->State= HAL_LPTIM_STATE_READY;
01263   
01264   /* Return function status */
01265   return HAL_OK;
01266 }
01267 
01268 /**
01269   * @brief  Stops the Counter mode.
01270   * @param  hlptim  LPTIM handle
01271   * @retval HAL status
01272   */
01273 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim)
01274 {
01275   /* Check the parameters */
01276   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01277   
01278   /* Set the LPTIM state */
01279   hlptim->State= HAL_LPTIM_STATE_BUSY;
01280   
01281   /* Disable the Peripheral */
01282   __HAL_LPTIM_DISABLE(hlptim);
01283   
01284   /* Change the TIM state*/
01285   hlptim->State= HAL_LPTIM_STATE_READY;
01286   
01287   /* Return function status */
01288   return HAL_OK;
01289 }
01290 
01291 /**
01292   * @brief  Starts the Counter mode in interrupt mode.
01293   * @param  hlptim  LPTIM handle
01294   * @param  Period  Specifies the Autoreload value.
01295   *         This parameter must be a value between 0x0000 and 0xFFFF.
01296   * @retval HAL status
01297   */
01298 HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period)
01299 {
01300   /* Check the parameters */
01301   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01302   assert_param(IS_LPTIM_PERIOD(Period));
01303                
01304   /* Set the LPTIM state */
01305   hlptim->State= HAL_LPTIM_STATE_BUSY;
01306 
01307   /* Enable EXTI Line interrupt on the LPTIM Wake-up Timer */
01308   __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT(); 
01309   
01310   /* Enable rising edge trigger on the LPTIM Wake-up Timer Exti line */
01311   __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();  
01312   
01313   /* If clock source is not ULPTIM clock and counter source is external, then it must not be prescaled */
01314   if((hlptim->Init.Clock.Source != LPTIM_CLOCKSOURCE_ULPTIM) && (hlptim->Init.CounterSource == LPTIM_COUNTERSOURCE_EXTERNAL))
01315   {
01316     /* Check if clock is prescaled */
01317     assert_param(IS_LPTIM_CLOCK_PRESCALERDIV1(hlptim->Init.Clock.Prescaler));
01318     /* Set clock prescaler to 0 */
01319     hlptim->Instance->CFGR &= ~LPTIM_CFGR_PRESC;
01320   }
01321   
01322   /* Enable Autoreload write complete interrupt */
01323   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
01324   
01325   /* Enable Autoreload match interrupt */
01326   __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
01327   
01328   /* Enable the Peripheral */
01329   __HAL_LPTIM_ENABLE(hlptim);
01330   
01331   /* Load the period value in the autoreload register */
01332   __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
01333   
01334   /* Start timer in continuous mode */
01335   __HAL_LPTIM_START_CONTINUOUS(hlptim);
01336     
01337   /* Change the TIM state*/
01338   hlptim->State= HAL_LPTIM_STATE_READY;
01339   
01340   /* Return function status */
01341   return HAL_OK;
01342 }
01343 
01344 /**
01345   * @brief  Stops the Counter mode in interrupt mode.
01346   * @param  hlptim  LPTIM handle
01347   * @retval HAL status
01348   */
01349 HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim)
01350 {
01351   /* Check the parameters */
01352   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01353   
01354   /* Set the LPTIM state */
01355   hlptim->State= HAL_LPTIM_STATE_BUSY;
01356   
01357   /* Disable rising edge trigger on the LPTIM Wake-up Timer Exti line */ 
01358   __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();
01359   
01360   /* Disable EXTI Line interrupt on the LPTIM Wake-up Timer */
01361   __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT(); 
01362   
01363   /* Disable the Peripheral */
01364   __HAL_LPTIM_DISABLE(hlptim);
01365   
01366   /* Disable Autoreload write complete interrupt */
01367   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
01368   
01369   /* Disable Autoreload match interrupt */
01370   __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
01371   
01372   /* Change the TIM state*/
01373   hlptim->State= HAL_LPTIM_STATE_READY;
01374   
01375   /* Return function status */
01376   return HAL_OK;
01377 }
01378 
01379 /**
01380   * @}
01381   */
01382 
01383 /** @defgroup LPTIM_Group3 LPTIM Read operation functions 
01384  *  @brief  Read operation functions.
01385  *
01386 @verbatim   
01387   ==============================================================================
01388                   ##### LPTIM Read operation functions #####
01389   ==============================================================================
01390 [..]  This section provides LPTIM Reading functions.
01391       (+) Read the counter value.
01392       (+) Read the period (Auto-reload) value.
01393       (+) Read the pulse (Compare)value.
01394 @endverbatim
01395   * @{
01396   */
01397 
01398 /**
01399   * @brief  This function returns the current counter value.
01400   * @param  hlptim LPTIM handle
01401   * @retval Counter value.
01402   */
01403 uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim)
01404 {
01405     /* Check the parameters */
01406   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01407   
01408   return (hlptim->Instance->CNT);
01409 }
01410 
01411 /**
01412   * @brief  This function return the current Autoreload (Period) value.
01413   * @param  hlptim LPTIM handle
01414   * @retval Autoreload value.
01415   */
01416 uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim)
01417 {
01418     /* Check the parameters */
01419   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01420   
01421   return (hlptim->Instance->ARR);
01422 }
01423 
01424 /**
01425   * @brief  This function return the current Compare (Pulse) value.
01426   * @param  hlptim LPTIM handle
01427   * @retval Compare value.
01428   */
01429 uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim)
01430 {
01431     /* Check the parameters */
01432   assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
01433   
01434   return (hlptim->Instance->CMP);
01435 }
01436 
01437 /**
01438   * @}
01439   */
01440 
01441 
01442 
01443 /** @defgroup LPTIM_Group4 LPTIM IRQ handler 
01444  *  @brief  LPTIM  IRQ handler.
01445  *
01446 @verbatim   
01447   ==============================================================================
01448                       ##### LPTIM IRQ handler  #####
01449   ==============================================================================
01450 [..]  This section provides LPTIM IRQ handler function.
01451 
01452 @endverbatim
01453   * @{
01454   */
01455 
01456 /**
01457   * @brief  This function handles LPTIM interrupt request.
01458   * @param  hlptim LPTIM handle
01459   * @retval None
01460   */
01461 void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim)
01462 {
01463   /* Compare match interrupt */
01464   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_CMPM) != RESET)
01465         {
01466     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_CMPM) !=RESET)
01467                 {
01468       /* Clear Compare match flag */
01469       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_CMPM);
01470       /* Compare match Callback */
01471       HAL_LPTIM_CompareMatchCallback(hlptim);      
01472     }
01473   }
01474   
01475   /* Autoreload match interrupt */
01476   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_ARRM) != RESET)
01477         {
01478     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_ARRM) !=RESET)
01479                 {
01480       /* Clear Autoreload match flag */
01481       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_ARRM);
01482       /* Autoreload match Callback */
01483       HAL_LPTIM_AutoReloadMatchCallback(hlptim);      
01484     }
01485   }
01486   
01487   /* Trigger detected interrupt */
01488   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_EXTTRIG) != RESET)
01489         {
01490     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_EXTTRIG) !=RESET)
01491                 {
01492       /* Clear Trigger detected flag */
01493       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_EXTTRIG);
01494       /* Trigger detected callback */
01495       HAL_LPTIM_TriggerCallback(hlptim);      
01496     }
01497   }
01498   
01499   /* Compare write interrupt */
01500   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_CMPOK) != RESET)
01501         {
01502     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_FLAG_CMPM) !=RESET)
01503                 {
01504       /* Clear Compare write flag */
01505       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_CMPOK);
01506       /* Compare write Callback */
01507       HAL_LPTIM_CompareWriteCallback(hlptim);      
01508     }
01509   }
01510   
01511   /* Autoreload write interrupt */
01512   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_ARROK) != RESET)
01513         {
01514     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_ARROK) !=RESET)
01515                 {
01516       /* Clear Autoreload write flag */
01517       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_ARROK);
01518       /* Autoreload write Callback */
01519       HAL_LPTIM_AutoReloadWriteCallback(hlptim);      
01520     }
01521   }
01522   
01523   /* Direction counter changed from Down to Up interrupt */
01524   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_UP) != RESET)
01525         {
01526     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_UP) !=RESET)
01527                 {
01528       /* Clear Direction counter changed from Down to Up flag */
01529       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_UP);
01530       /* Direction counter changed from Down to Up Callback */
01531       HAL_LPTIM_DirectionUpCallback(hlptim);      
01532     }
01533   }
01534   
01535   /* Direction counter changed from Up to Down interrupt */
01536   if(__HAL_LPTIM_GET_FLAG(hlptim, LPTIM_FLAG_DOWN) != RESET)
01537         {
01538     if(__HAL_LPTIM_GET_IT_SOURCE(hlptim, LPTIM_IT_DOWN) !=RESET)
01539                 {
01540       /* Clear Direction counter changed from Up to Down flag */
01541       __HAL_LPTIM_CLEAR_FLAG(hlptim, LPTIM_FLAG_DOWN);
01542       /* Direction counter changed from Up to Down Callback */
01543       HAL_LPTIM_DirectionDownCallback(hlptim);      
01544     }
01545   }
01546   __HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG();
01547 }
01548 
01549 /**
01550   * @brief  Compare match callback in non blocking mode 
01551   * @param  hlptim  LPTIM handle
01552   * @retval None
01553   */
01554 __weak void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
01555 {
01556   /* Prevent unused argument(s) compilation warning */
01557   UNUSED(hlptim);
01558   /* NOTE : This function Should not be modified, when the callback is needed,
01559             the HAL_LPTIM_CompareMatchCallback could be implemented in the user file
01560    */  
01561 }
01562 
01563 /**
01564   * @brief  Autoreload match callback in non blocking mode 
01565   * @param  hlptim  LPTIM handle
01566   * @retval None
01567   */
01568 __weak void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim)
01569 {
01570   /* Prevent unused argument(s) compilation warning */
01571   UNUSED(hlptim);
01572   /* NOTE : This function Should not be modified, when the callback is needed,
01573             the HAL_LPTIM_AutoReloadMatchCallback could be implemented in the user file
01574    */  
01575 }
01576 
01577 /**
01578   * @brief  Trigger detected callback in non blocking mode 
01579   * @param  hlptim  LPTIM handle
01580   * @retval None
01581   */
01582 __weak void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim)
01583 {
01584   /* Prevent unused argument(s) compilation warning */
01585   UNUSED(hlptim);
01586   /* NOTE : This function Should not be modified, when the callback is needed,
01587             the HAL_LPTIM_TriggerCallback could be implemented in the user file
01588    */  
01589 }
01590 
01591 /**
01592   * @brief  Compare write callback in non blocking mode 
01593   * @param  hlptim  LPTIM handle
01594   * @retval None
01595   */
01596 __weak void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim)
01597 {
01598   /* Prevent unused argument(s) compilation warning */
01599   UNUSED(hlptim);
01600   /* NOTE : This function Should not be modified, when the callback is needed,
01601             the HAL_LPTIM_CompareWriteCallback could be implemented in the user file
01602    */  
01603 }
01604 
01605 /**
01606   * @brief  Autoreload write callback in non blocking mode 
01607   * @param  hlptim  LPTIM handle
01608   * @retval None
01609   */
01610 __weak void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim)
01611 {
01612   /* Prevent unused argument(s) compilation warning */
01613   UNUSED(hlptim);
01614   /* NOTE : This function Should not be modified, when the callback is needed,
01615             the HAL_LPTIM_AutoReloadWriteCallback could be implemented in the user file
01616    */  
01617 }
01618 
01619 /**
01620   * @brief  Direction counter changed from Down to Up callback in non blocking mode 
01621   * @param  hlptim  LPTIM handle
01622   * @retval None
01623   */
01624 __weak void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim)
01625 {
01626   /* Prevent unused argument(s) compilation warning */
01627   UNUSED(hlptim);
01628   /* NOTE : This function Should not be modified, when the callback is needed,
01629             the HAL_LPTIM_DirectionUpCallback could be implemented in the user file
01630    */  
01631 }
01632 
01633 /**
01634   * @brief  Direction counter changed from Up to Down callback in non blocking mode 
01635   * @param  hlptim  LPTIM handle
01636   * @retval None
01637   */
01638 __weak void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim)
01639 {
01640   /* Prevent unused argument(s) compilation warning */
01641   UNUSED(hlptim);
01642   /* NOTE : This function Should not be modified, when the callback is needed,
01643             the HAL_LPTIM_DirectionDownCallback could be implemented in the user file
01644    */  
01645 }
01646 
01647 /**
01648   * @}
01649   */
01650 
01651 /** @defgroup LPTIM_Group5 Peripheral State functions 
01652  *  @brief   Peripheral State functions. 
01653  *
01654 @verbatim   
01655   ==============================================================================
01656                       ##### Peripheral State functions #####
01657   ==============================================================================
01658     [..]
01659     This subsection permits to get in run-time the status of the peripheral.
01660 
01661 @endverbatim
01662   * @{
01663   */
01664 
01665 /**
01666   * @brief  Returns the LPTIM state.
01667   * @param  hlptim LPTIM handle
01668   * @retval HAL state
01669   */
01670 HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim)
01671 {
01672   return hlptim->State;
01673 }
01674 
01675 /**
01676   * @}
01677   */
01678 
01679 
01680 /**
01681   * @}
01682   */
01683 
01684 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ 
01685 #endif /* HAL_LPTIM_MODULE_ENABLED */
01686 /**
01687   * @}
01688   */
01689 
01690 /**
01691   * @}
01692   */
01693 
01694 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/