The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NUCLEO_L486RG/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_ll_lptim.h@145:64910690c574, 2017-06-21 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Jun 21 17:31:38 2017 +0100
- Revision:
- 145:64910690c574
- Parent:
- 128:9bcdf88f62b0
Release 145 of the mbed library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 122:f9eeca106725 | 1 | /** |
Kojto | 122:f9eeca106725 | 2 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 3 | * @file stm32l4xx_ll_lptim.h |
Kojto | 122:f9eeca106725 | 4 | * @author MCD Application Team |
AnnaBridge | 145:64910690c574 | 5 | * @version V1.7.1 |
AnnaBridge | 145:64910690c574 | 6 | * @date 21-April-2017 |
Kojto | 122:f9eeca106725 | 7 | * @brief Header file of LPTIM LL module. |
Kojto | 122:f9eeca106725 | 8 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 9 | * @attention |
Kojto | 122:f9eeca106725 | 10 | * |
AnnaBridge | 145:64910690c574 | 11 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
Kojto | 122:f9eeca106725 | 12 | * |
Kojto | 122:f9eeca106725 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 122:f9eeca106725 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 122:f9eeca106725 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 122:f9eeca106725 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 122:f9eeca106725 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 122:f9eeca106725 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 122:f9eeca106725 | 19 | * and/or other materials provided with the distribution. |
Kojto | 122:f9eeca106725 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 122:f9eeca106725 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 122:f9eeca106725 | 22 | * without specific prior written permission. |
Kojto | 122:f9eeca106725 | 23 | * |
Kojto | 122:f9eeca106725 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 122:f9eeca106725 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 122:f9eeca106725 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 122:f9eeca106725 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 122:f9eeca106725 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 122:f9eeca106725 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 122:f9eeca106725 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 122:f9eeca106725 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 122:f9eeca106725 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 122:f9eeca106725 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 122:f9eeca106725 | 34 | * |
Kojto | 122:f9eeca106725 | 35 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 36 | */ |
Kojto | 122:f9eeca106725 | 37 | |
Kojto | 122:f9eeca106725 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 122:f9eeca106725 | 39 | #ifndef __STM32L4xx_LL_LPTIM_H |
Kojto | 122:f9eeca106725 | 40 | #define __STM32L4xx_LL_LPTIM_H |
Kojto | 122:f9eeca106725 | 41 | |
Kojto | 122:f9eeca106725 | 42 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 43 | extern "C" { |
Kojto | 122:f9eeca106725 | 44 | #endif |
Kojto | 122:f9eeca106725 | 45 | |
Kojto | 122:f9eeca106725 | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 47 | #include "stm32l4xx.h" |
Kojto | 122:f9eeca106725 | 48 | |
Kojto | 122:f9eeca106725 | 49 | /** @addtogroup STM32L4xx_LL_Driver |
Kojto | 122:f9eeca106725 | 50 | * @{ |
Kojto | 122:f9eeca106725 | 51 | */ |
Kojto | 122:f9eeca106725 | 52 | #if defined (LPTIM1) || defined (LPTIM2) |
Kojto | 122:f9eeca106725 | 53 | |
Kojto | 122:f9eeca106725 | 54 | /** @defgroup LPTIM_LL LPTIM |
Kojto | 122:f9eeca106725 | 55 | * @{ |
Kojto | 122:f9eeca106725 | 56 | */ |
Kojto | 122:f9eeca106725 | 57 | |
Kojto | 122:f9eeca106725 | 58 | /* Private types -------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 59 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 60 | |
Kojto | 122:f9eeca106725 | 61 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 62 | |
Kojto | 122:f9eeca106725 | 63 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 64 | #if defined(USE_FULL_LL_DRIVER) |
Kojto | 122:f9eeca106725 | 65 | /** @defgroup LPTIM_LL_Private_Macros LPTIM Private Macros |
Kojto | 122:f9eeca106725 | 66 | * @{ |
Kojto | 122:f9eeca106725 | 67 | */ |
Kojto | 122:f9eeca106725 | 68 | /** |
Kojto | 122:f9eeca106725 | 69 | * @} |
Kojto | 122:f9eeca106725 | 70 | */ |
Kojto | 122:f9eeca106725 | 71 | #endif /*USE_FULL_LL_DRIVER*/ |
Kojto | 122:f9eeca106725 | 72 | |
Kojto | 122:f9eeca106725 | 73 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 74 | #if defined(USE_FULL_LL_DRIVER) |
Kojto | 122:f9eeca106725 | 75 | /** @defgroup LPTIM_LL_ES_INIT LPTIM Exported Init structure |
Kojto | 122:f9eeca106725 | 76 | * @{ |
Kojto | 122:f9eeca106725 | 77 | */ |
Kojto | 122:f9eeca106725 | 78 | |
Kojto | 122:f9eeca106725 | 79 | /** |
Kojto | 122:f9eeca106725 | 80 | * @brief LPTIM Init structure definition |
Kojto | 122:f9eeca106725 | 81 | */ |
Kojto | 122:f9eeca106725 | 82 | typedef struct |
Kojto | 122:f9eeca106725 | 83 | { |
Kojto | 122:f9eeca106725 | 84 | uint32_t ClockSource; /*!< Specifies the source of the clock used by the LPTIM instance. |
Kojto | 122:f9eeca106725 | 85 | This parameter can be a value of @ref LPTIM_LL_EC_CLK_SOURCE. |
Kojto | 122:f9eeca106725 | 86 | |
Kojto | 122:f9eeca106725 | 87 | This feature can be modified afterwards using unitary function @ref LL_LPTIM_SetClockSource().*/ |
Kojto | 122:f9eeca106725 | 88 | |
Kojto | 122:f9eeca106725 | 89 | uint32_t Prescaler; /*!< Specifies the prescaler division ratio. |
Kojto | 122:f9eeca106725 | 90 | This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER. |
Kojto | 122:f9eeca106725 | 91 | |
Kojto | 122:f9eeca106725 | 92 | This feature can be modified afterwards using using unitary function @ref LL_LPTIM_SetPrescaler().*/ |
Kojto | 122:f9eeca106725 | 93 | |
Kojto | 122:f9eeca106725 | 94 | uint32_t Waveform; /*!< Specifies the waveform shape. |
Kojto | 122:f9eeca106725 | 95 | This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_WAVEFORM. |
Kojto | 122:f9eeca106725 | 96 | |
Kojto | 122:f9eeca106725 | 97 | This feature can be modified afterwards using unitary function @ref LL_LPTIM_ConfigOutput().*/ |
Kojto | 122:f9eeca106725 | 98 | |
Kojto | 122:f9eeca106725 | 99 | uint32_t Polarity; /*!< Specifies waveform polarity. |
Kojto | 122:f9eeca106725 | 100 | This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_POLARITY. |
Kojto | 122:f9eeca106725 | 101 | |
Kojto | 122:f9eeca106725 | 102 | This feature can be modified afterwards using unitary function @ref LL_LPTIM_ConfigOutput().*/ |
Kojto | 122:f9eeca106725 | 103 | } LL_LPTIM_InitTypeDef; |
Kojto | 122:f9eeca106725 | 104 | |
Kojto | 122:f9eeca106725 | 105 | /** |
Kojto | 122:f9eeca106725 | 106 | * @} |
Kojto | 122:f9eeca106725 | 107 | */ |
Kojto | 122:f9eeca106725 | 108 | #endif /* USE_FULL_LL_DRIVER */ |
Kojto | 122:f9eeca106725 | 109 | |
Kojto | 122:f9eeca106725 | 110 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 111 | /** @defgroup LPTIM_LL_Exported_Constants LPTIM Exported Constants |
Kojto | 122:f9eeca106725 | 112 | * @{ |
Kojto | 122:f9eeca106725 | 113 | */ |
Kojto | 122:f9eeca106725 | 114 | |
Kojto | 122:f9eeca106725 | 115 | /** @defgroup LPTIM_LL_EC_GET_FLAG Get Flags Defines |
Kojto | 122:f9eeca106725 | 116 | * @brief Flags defines which can be used with LL_LPTIM_ReadReg function |
Kojto | 122:f9eeca106725 | 117 | * @{ |
Kojto | 122:f9eeca106725 | 118 | */ |
Kojto | 122:f9eeca106725 | 119 | #define LL_LPTIM_ISR_CMPM LPTIM_ISR_CMPM /*!< Compare match */ |
Kojto | 122:f9eeca106725 | 120 | #define LL_LPTIM_ISR_ARRM LPTIM_ISR_ARRM /*!< Autoreload match */ |
Kojto | 122:f9eeca106725 | 121 | #define LL_LPTIM_ISR_EXTTRIG LPTIM_ISR_EXTTRIG /*!< External trigger edge event */ |
Kojto | 122:f9eeca106725 | 122 | #define LL_LPTIM_ISR_CMPOK LPTIM_ISR_CMPOK /*!< Compare register update OK */ |
Kojto | 122:f9eeca106725 | 123 | #define LL_LPTIM_ISR_ARROK LPTIM_ISR_ARROK /*!< Autoreload register update OK */ |
Kojto | 122:f9eeca106725 | 124 | #define LL_LPTIM_ISR_UP LPTIM_ISR_UP /*!< Counter direction change down to up */ |
Kojto | 122:f9eeca106725 | 125 | #define LL_LPTIM_ISR_DOWN LPTIM_ISR_DOWN /*!< Counter direction change up to down */ |
Kojto | 122:f9eeca106725 | 126 | /** |
Kojto | 122:f9eeca106725 | 127 | * @} |
Kojto | 122:f9eeca106725 | 128 | */ |
Kojto | 122:f9eeca106725 | 129 | |
Kojto | 122:f9eeca106725 | 130 | /** @defgroup LPTIM_LL_EC_IT IT Defines |
Kojto | 122:f9eeca106725 | 131 | * @brief IT defines which can be used with LL_LPTIM_ReadReg and LL_LPTIM_WriteReg functions |
Kojto | 122:f9eeca106725 | 132 | * @{ |
Kojto | 122:f9eeca106725 | 133 | */ |
Kojto | 122:f9eeca106725 | 134 | #define LL_LPTIM_IER_CMPMIE LPTIM_IER_CMPMIE /*!< Compare match Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 135 | #define LL_LPTIM_IER_ARRMIE LPTIM_IER_ARRMIE /*!< Autoreload match Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 136 | #define LL_LPTIM_IER_EXTTRIGIE LPTIM_IER_EXTTRIGIE /*!< External trigger valid edge Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 137 | #define LL_LPTIM_IER_CMPOKIE LPTIM_IER_CMPOKIE /*!< Compare register update OK Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 138 | #define LL_LPTIM_IER_ARROKIE LPTIM_IER_ARROKIE /*!< Autoreload register update OK Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 139 | #define LL_LPTIM_IER_UPIE LPTIM_IER_UPIE /*!< Direction change to UP Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 140 | #define LL_LPTIM_IER_DOWNIE LPTIM_IER_DOWNIE /*!< Direction change to down Interrupt Enable */ |
Kojto | 122:f9eeca106725 | 141 | /** |
Kojto | 122:f9eeca106725 | 142 | * @} |
Kojto | 122:f9eeca106725 | 143 | */ |
Kojto | 122:f9eeca106725 | 144 | |
Kojto | 122:f9eeca106725 | 145 | /** @defgroup LPTIM_LL_EC_OPERATING_MODE Operating Mode |
Kojto | 122:f9eeca106725 | 146 | * @{ |
Kojto | 122:f9eeca106725 | 147 | */ |
Kojto | 122:f9eeca106725 | 148 | #define LL_LPTIM_OPERATING_MODE_CONTINUOUS LPTIM_CR_CNTSTRT /*!<LP Timer starts in continuous mode*/ |
Kojto | 122:f9eeca106725 | 149 | #define LL_LPTIM_OPERATING_MODE_ONESHOT LPTIM_CR_SNGSTRT /*!<LP Tilmer starts in single mode*/ |
Kojto | 122:f9eeca106725 | 150 | /** |
Kojto | 122:f9eeca106725 | 151 | * @} |
Kojto | 122:f9eeca106725 | 152 | */ |
Kojto | 122:f9eeca106725 | 153 | |
Kojto | 122:f9eeca106725 | 154 | /** @defgroup LPTIM_LL_EC_UPDATE_MODE Update Mode |
Kojto | 122:f9eeca106725 | 155 | * @{ |
Kojto | 122:f9eeca106725 | 156 | */ |
AnnaBridge | 145:64910690c574 | 157 | #define LL_LPTIM_UPDATE_MODE_IMMEDIATE 0x00000000U /*!<Preload is disabled: registers are updated after each APB bus write access*/ |
Kojto | 122:f9eeca106725 | 158 | #define LL_LPTIM_UPDATE_MODE_ENDOFPERIOD LPTIM_CFGR_PRELOAD /*!<preload is enabled: registers are updated at the end of the current LPTIM period*/ |
Kojto | 122:f9eeca106725 | 159 | /** |
Kojto | 122:f9eeca106725 | 160 | * @} |
Kojto | 122:f9eeca106725 | 161 | */ |
Kojto | 122:f9eeca106725 | 162 | |
Kojto | 122:f9eeca106725 | 163 | /** @defgroup LPTIM_LL_EC_COUNTER_MODE Counter Mode |
Kojto | 122:f9eeca106725 | 164 | * @{ |
Kojto | 122:f9eeca106725 | 165 | */ |
AnnaBridge | 145:64910690c574 | 166 | #define LL_LPTIM_COUNTER_MODE_INTERNAL 0x00000000U /*!<The counter is incremented following each internal clock pulse*/ |
Kojto | 122:f9eeca106725 | 167 | #define LL_LPTIM_COUNTER_MODE_EXTERNAL LPTIM_CFGR_COUNTMODE /*!<The counter is incremented following each valid clock pulse on the LPTIM external Input1*/ |
Kojto | 122:f9eeca106725 | 168 | /** |
Kojto | 122:f9eeca106725 | 169 | * @} |
Kojto | 122:f9eeca106725 | 170 | */ |
Kojto | 122:f9eeca106725 | 171 | |
Kojto | 122:f9eeca106725 | 172 | /** @defgroup LPTIM_LL_EC_OUTPUT_WAVEFORM Output Waveform Type |
Kojto | 122:f9eeca106725 | 173 | * @{ |
Kojto | 122:f9eeca106725 | 174 | */ |
AnnaBridge | 145:64910690c574 | 175 | #define LL_LPTIM_OUTPUT_WAVEFORM_PWM 0x00000000U /*!<LPTIM generates either a PWM waveform or a One pulse waveform depending on chosen operating mode CONTINOUS or SINGLE*/ |
Kojto | 122:f9eeca106725 | 176 | #define LL_LPTIM_OUTPUT_WAVEFORM_SETONCE LPTIM_CFGR_WAVE /*!<LPTIM generates a Set Once waveform*/ |
Kojto | 122:f9eeca106725 | 177 | /** |
Kojto | 122:f9eeca106725 | 178 | * @} |
Kojto | 122:f9eeca106725 | 179 | */ |
Kojto | 122:f9eeca106725 | 180 | |
Kojto | 122:f9eeca106725 | 181 | /** @defgroup LPTIM_LL_EC_OUTPUT_POLARITY Output Polarity |
Kojto | 122:f9eeca106725 | 182 | * @{ |
Kojto | 122:f9eeca106725 | 183 | */ |
AnnaBridge | 145:64910690c574 | 184 | #define LL_LPTIM_OUTPUT_POLARITY_REGULAR 0x00000000U /*!<The LPTIM output reflects the compare results between LPTIMx_ARR and LPTIMx_CMP registers*/ |
Kojto | 122:f9eeca106725 | 185 | #define LL_LPTIM_OUTPUT_POLARITY_INVERSE LPTIM_CFGR_WAVPOL /*!<The LPTIM output reflects the inverse of the compare results between LPTIMx_ARR and LPTIMx_CMP registers*/ |
Kojto | 122:f9eeca106725 | 186 | /** |
Kojto | 122:f9eeca106725 | 187 | * @} |
Kojto | 122:f9eeca106725 | 188 | */ |
Kojto | 122:f9eeca106725 | 189 | |
Kojto | 122:f9eeca106725 | 190 | /** @defgroup LPTIM_LL_EC_PRESCALER Prescaler Value |
Kojto | 122:f9eeca106725 | 191 | * @{ |
Kojto | 122:f9eeca106725 | 192 | */ |
AnnaBridge | 145:64910690c574 | 193 | #define LL_LPTIM_PRESCALER_DIV1 0x00000000U /*!<Prescaler division factor is set to 1*/ |
Kojto | 122:f9eeca106725 | 194 | #define LL_LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 /*!<Prescaler division factor is set to 2*/ |
Kojto | 122:f9eeca106725 | 195 | #define LL_LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 /*!<Prescaler division factor is set to 4*/ |
Kojto | 122:f9eeca106725 | 196 | #define LL_LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 8*/ |
Kojto | 122:f9eeca106725 | 197 | #define LL_LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 /*!<Prescaler division factor is set to 16*/ |
Kojto | 122:f9eeca106725 | 198 | #define LL_LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 32*/ |
Kojto | 122:f9eeca106725 | 199 | #define LL_LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_1) /*!<Prescaler division factor is set to 64*/ |
Kojto | 122:f9eeca106725 | 200 | #define LL_LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC /*!<Prescaler division factor is set to 128*/ |
Kojto | 122:f9eeca106725 | 201 | /** |
Kojto | 122:f9eeca106725 | 202 | * @} |
Kojto | 122:f9eeca106725 | 203 | */ |
Kojto | 122:f9eeca106725 | 204 | |
Kojto | 122:f9eeca106725 | 205 | /** @defgroup LPTIM_LL_EC_TRIG_SOURCE Trigger Source |
Kojto | 122:f9eeca106725 | 206 | * @{ |
Kojto | 122:f9eeca106725 | 207 | */ |
AnnaBridge | 145:64910690c574 | 208 | #define LL_LPTIM_TRIG_SOURCE_GPIO 0x00000000U /*!<External input trigger is connected to TIMx_ETR input*/ |
Kojto | 122:f9eeca106725 | 209 | #define LL_LPTIM_TRIG_SOURCE_RTCALARMA LPTIM_CFGR_TRIGSEL_0 /*!<External input trigger is connected to RTC Alarm A*/ |
Kojto | 122:f9eeca106725 | 210 | #define LL_LPTIM_TRIG_SOURCE_RTCALARMB LPTIM_CFGR_TRIGSEL_1 /*!<External input trigger is connected to RTC Alarm B*/ |
Kojto | 122:f9eeca106725 | 211 | #define LL_LPTIM_TRIG_SOURCE_RTCTAMP1 (LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to RTC Tamper 1*/ |
Kojto | 122:f9eeca106725 | 212 | #define LL_LPTIM_TRIG_SOURCE_RTCTAMP2 LPTIM_CFGR_TRIGSEL_2 /*!<External input trigger is connected to RTC Tamper 2*/ |
Kojto | 122:f9eeca106725 | 213 | #define LL_LPTIM_TRIG_SOURCE_RTCTAMP3 (LPTIM_CFGR_TRIGSEL_2 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to RTC Tamper 3*/ |
Kojto | 122:f9eeca106725 | 214 | #define LL_LPTIM_TRIG_SOURCE_COMP1 (LPTIM_CFGR_TRIGSEL_2 | LPTIM_CFGR_TRIGSEL_1) /*!<External input trigger is connected to COMP1 output*/ |
Kojto | 122:f9eeca106725 | 215 | #define LL_LPTIM_TRIG_SOURCE_COMP2 LPTIM_CFGR_TRIGSEL /*!<External input trigger is connected to COMP2 output*/ |
Kojto | 122:f9eeca106725 | 216 | /** |
Kojto | 122:f9eeca106725 | 217 | * @} |
Kojto | 122:f9eeca106725 | 218 | */ |
Kojto | 122:f9eeca106725 | 219 | |
Kojto | 122:f9eeca106725 | 220 | /** @defgroup LPTIM_LL_EC_TRIG_FILTER Trigger Filter |
Kojto | 122:f9eeca106725 | 221 | * @{ |
Kojto | 122:f9eeca106725 | 222 | */ |
AnnaBridge | 145:64910690c574 | 223 | #define LL_LPTIM_TRIG_FILTER_NONE 0x00000000U /*!<Any trigger active level change is considered as a valid trigger*/ |
Kojto | 122:f9eeca106725 | 224 | #define LL_LPTIM_TRIG_FILTER_2 LPTIM_CFGR_TRGFLT_0 /*!<Trigger active level change must be stable for at least 2 clock periods before it is considered as valid trigger*/ |
Kojto | 122:f9eeca106725 | 225 | #define LL_LPTIM_TRIG_FILTER_4 LPTIM_CFGR_TRGFLT_1 /*!<Trigger active level change must be stable for at least 4 clock periods before it is considered as valid trigger*/ |
Kojto | 122:f9eeca106725 | 226 | #define LL_LPTIM_TRIG_FILTER_8 LPTIM_CFGR_TRGFLT /*!<Trigger active level change must be stable for at least 8 clock periods before it is considered as valid trigger*/ |
Kojto | 122:f9eeca106725 | 227 | /** |
Kojto | 122:f9eeca106725 | 228 | * @} |
Kojto | 122:f9eeca106725 | 229 | */ |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | /** @defgroup LPTIM_LL_EC_TRIG_POLARITY Trigger Polarity |
Kojto | 122:f9eeca106725 | 232 | * @{ |
Kojto | 122:f9eeca106725 | 233 | */ |
Kojto | 122:f9eeca106725 | 234 | #define LL_LPTIM_TRIG_POLARITY_RISING LPTIM_CFGR_TRIGEN_0 /*!<LPTIM counter starts when a rising edge is detected*/ |
Kojto | 122:f9eeca106725 | 235 | #define LL_LPTIM_TRIG_POLARITY_FALLING LPTIM_CFGR_TRIGEN_1 /*!<LPTIM counter starts when a falling edge is detected*/ |
Kojto | 122:f9eeca106725 | 236 | #define LL_LPTIM_TRIG_POLARITY_RISING_FALLING LPTIM_CFGR_TRIGEN /*!<LPTIM counter starts when a rising or a falling edge is detected*/ |
Kojto | 122:f9eeca106725 | 237 | /** |
Kojto | 122:f9eeca106725 | 238 | * @} |
Kojto | 122:f9eeca106725 | 239 | */ |
Kojto | 122:f9eeca106725 | 240 | |
Kojto | 122:f9eeca106725 | 241 | /** @defgroup LPTIM_LL_EC_CLK_SOURCE Clock Source |
Kojto | 122:f9eeca106725 | 242 | * @{ |
Kojto | 122:f9eeca106725 | 243 | */ |
AnnaBridge | 145:64910690c574 | 244 | #define LL_LPTIM_CLK_SOURCE_INTERNAL 0x00000000U /*!<LPTIM is clocked by internal clock source (APB clock or any of the embedded oscillators)*/ |
Kojto | 122:f9eeca106725 | 245 | #define LL_LPTIM_CLK_SOURCE_EXTERNAL LPTIM_CFGR_CKSEL /*!<LPTIM is clocked by an external clock source through the LPTIM external Input1*/ |
Kojto | 122:f9eeca106725 | 246 | /** |
Kojto | 122:f9eeca106725 | 247 | * @} |
Kojto | 122:f9eeca106725 | 248 | */ |
Kojto | 122:f9eeca106725 | 249 | |
Kojto | 122:f9eeca106725 | 250 | /** @defgroup LPTIM_LL_EC_CLK_FILTER Clock Filter |
Kojto | 122:f9eeca106725 | 251 | * @{ |
Kojto | 122:f9eeca106725 | 252 | */ |
AnnaBridge | 145:64910690c574 | 253 | #define LL_LPTIM_CLK_FILTER_NONE 0x00000000U /*!<Any external clock signal level change is considered as a valid transition*/ |
Kojto | 122:f9eeca106725 | 254 | #define LL_LPTIM_CLK_FILTER_2 LPTIM_CFGR_CKFLT_0 /*!<External clock signal level change must be stable for at least 2 clock periods before it is considered as valid transition*/ |
Kojto | 122:f9eeca106725 | 255 | #define LL_LPTIM_CLK_FILTER_4 LPTIM_CFGR_CKFLT_1 /*!<External clock signal level change must be stable for at least 4 clock periods before it is considered as valid transition*/ |
Kojto | 122:f9eeca106725 | 256 | #define LL_LPTIM_CLK_FILTER_8 LPTIM_CFGR_CKFLT /*!<External clock signal level change must be stable for at least 8 clock periods before it is considered as valid transition*/ |
Kojto | 122:f9eeca106725 | 257 | /** |
Kojto | 122:f9eeca106725 | 258 | * @} |
Kojto | 122:f9eeca106725 | 259 | */ |
Kojto | 122:f9eeca106725 | 260 | |
Kojto | 122:f9eeca106725 | 261 | /** @defgroup LPTIM_LL_EC_CLK_POLARITY Clock Polarity |
Kojto | 122:f9eeca106725 | 262 | * @{ |
Kojto | 122:f9eeca106725 | 263 | */ |
AnnaBridge | 145:64910690c574 | 264 | #define LL_LPTIM_CLK_POLARITY_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/ |
Kojto | 122:f9eeca106725 | 265 | #define LL_LPTIM_CLK_POLARITY_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/ |
Kojto | 122:f9eeca106725 | 266 | #define LL_LPTIM_CLK_POLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/ |
Kojto | 122:f9eeca106725 | 267 | /** |
Kojto | 122:f9eeca106725 | 268 | * @} |
Kojto | 122:f9eeca106725 | 269 | */ |
Kojto | 122:f9eeca106725 | 270 | |
Kojto | 122:f9eeca106725 | 271 | /** @defgroup LPTIM_LL_EC_ENCODER_MODE Encoder Mode |
Kojto | 122:f9eeca106725 | 272 | * @{ |
Kojto | 122:f9eeca106725 | 273 | */ |
AnnaBridge | 145:64910690c574 | 274 | #define LL_LPTIM_ENCODER_MODE_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/ |
Kojto | 122:f9eeca106725 | 275 | #define LL_LPTIM_ENCODER_MODE_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/ |
Kojto | 122:f9eeca106725 | 276 | #define LL_LPTIM_ENCODER_MODE_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/ |
Kojto | 122:f9eeca106725 | 277 | /** |
Kojto | 122:f9eeca106725 | 278 | * @} |
Kojto | 122:f9eeca106725 | 279 | */ |
Kojto | 122:f9eeca106725 | 280 | |
Kojto | 122:f9eeca106725 | 281 | /** @defgroup LPTIM_EC_INPUT1_SRC Input1 Source |
Kojto | 122:f9eeca106725 | 282 | * @{ |
Kojto | 122:f9eeca106725 | 283 | */ |
AnnaBridge | 145:64910690c574 | 284 | #define LL_LPTIM_INPUT1_SRC_GPIO 0x00000000U /*!< For LPTIM1 and LPTIM2 */ |
Kojto | 122:f9eeca106725 | 285 | #define LL_LPTIM_INPUT1_SRC_COMP1 LPTIM_OR_OR_0 /*!< For LPTIM1 and LPTIM2 */ |
Kojto | 122:f9eeca106725 | 286 | #define LL_LPTIM_INPUT1_SRC_COMP2 LPTIM_OR_OR_1 /*!< For LPTIM2 */ |
Kojto | 122:f9eeca106725 | 287 | #define LL_LPTIM_INPUT1_SRC_COMP1_COMP2 LPTIM_OR_OR /*!< For LPTIM2 */ |
Kojto | 122:f9eeca106725 | 288 | /** |
Kojto | 122:f9eeca106725 | 289 | * @} |
Kojto | 122:f9eeca106725 | 290 | */ |
Kojto | 122:f9eeca106725 | 291 | |
Kojto | 122:f9eeca106725 | 292 | /** @defgroup LPTIM_EC_INPUT2_SRC Input2 Source |
Kojto | 122:f9eeca106725 | 293 | * @{ |
Kojto | 122:f9eeca106725 | 294 | */ |
AnnaBridge | 145:64910690c574 | 295 | #define LL_LPTIM_INPUT2_SRC_GPIO 0x00000000U /*!< For LPTIM1 */ |
Kojto | 122:f9eeca106725 | 296 | #define LL_LPTIM_INPUT2_SRC_COMP2 LPTIM_OR_OR_1 /*!< For LPTIM1 */ |
Kojto | 122:f9eeca106725 | 297 | /** |
Kojto | 122:f9eeca106725 | 298 | * @} |
Kojto | 122:f9eeca106725 | 299 | */ |
Kojto | 122:f9eeca106725 | 300 | |
Kojto | 122:f9eeca106725 | 301 | /** |
Kojto | 122:f9eeca106725 | 302 | * @} |
Kojto | 122:f9eeca106725 | 303 | */ |
Kojto | 122:f9eeca106725 | 304 | |
Kojto | 122:f9eeca106725 | 305 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 306 | /** @defgroup LPTIM_LL_Exported_Macros LPTIM Exported Macros |
Kojto | 122:f9eeca106725 | 307 | * @{ |
Kojto | 122:f9eeca106725 | 308 | */ |
Kojto | 122:f9eeca106725 | 309 | |
Kojto | 122:f9eeca106725 | 310 | /** @defgroup LPTIM_LL_EM_WRITE_READ Common Write and read registers Macros |
Kojto | 122:f9eeca106725 | 311 | * @{ |
Kojto | 122:f9eeca106725 | 312 | */ |
Kojto | 122:f9eeca106725 | 313 | |
Kojto | 122:f9eeca106725 | 314 | /** |
Kojto | 122:f9eeca106725 | 315 | * @brief Write a value in LPTIM register |
Kojto | 122:f9eeca106725 | 316 | * @param __INSTANCE__ LPTIM Instance |
Kojto | 122:f9eeca106725 | 317 | * @param __REG__ Register to be written |
Kojto | 122:f9eeca106725 | 318 | * @param __VALUE__ Value to be written in the register |
Kojto | 122:f9eeca106725 | 319 | * @retval None |
Kojto | 122:f9eeca106725 | 320 | */ |
Kojto | 122:f9eeca106725 | 321 | #define LL_LPTIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
Kojto | 122:f9eeca106725 | 322 | |
Kojto | 122:f9eeca106725 | 323 | /** |
Kojto | 122:f9eeca106725 | 324 | * @brief Read a value in LPTIM register |
Kojto | 122:f9eeca106725 | 325 | * @param __INSTANCE__ LPTIM Instance |
Kojto | 122:f9eeca106725 | 326 | * @param __REG__ Register to be read |
Kojto | 122:f9eeca106725 | 327 | * @retval Register value |
Kojto | 122:f9eeca106725 | 328 | */ |
Kojto | 122:f9eeca106725 | 329 | #define LL_LPTIM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
Kojto | 122:f9eeca106725 | 330 | /** |
Kojto | 122:f9eeca106725 | 331 | * @} |
Kojto | 122:f9eeca106725 | 332 | */ |
Kojto | 122:f9eeca106725 | 333 | |
Kojto | 122:f9eeca106725 | 334 | /** |
Kojto | 122:f9eeca106725 | 335 | * @} |
Kojto | 122:f9eeca106725 | 336 | */ |
Kojto | 122:f9eeca106725 | 337 | |
Kojto | 122:f9eeca106725 | 338 | |
Kojto | 122:f9eeca106725 | 339 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 340 | /** @defgroup LPTIM_LL_Exported_Functions LPTIM Exported Functions |
Kojto | 122:f9eeca106725 | 341 | * @{ |
Kojto | 122:f9eeca106725 | 342 | */ |
Kojto | 122:f9eeca106725 | 343 | |
Kojto | 122:f9eeca106725 | 344 | /** @defgroup LPTIM_LL_EF_LPTIM_Configuration LPTIM Configuration |
Kojto | 122:f9eeca106725 | 345 | * @{ |
Kojto | 122:f9eeca106725 | 346 | */ |
Kojto | 122:f9eeca106725 | 347 | |
Kojto | 122:f9eeca106725 | 348 | /** |
Kojto | 122:f9eeca106725 | 349 | * @brief Enable the LPTIM instance |
Kojto | 122:f9eeca106725 | 350 | * @note After setting the ENABLE bit, a delay of two counter clock is needed |
Kojto | 122:f9eeca106725 | 351 | * before the LPTIM instance is actually enabled. |
Kojto | 122:f9eeca106725 | 352 | * @rmtoll CR ENABLE LL_LPTIM_Enable |
Kojto | 122:f9eeca106725 | 353 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 354 | * @retval None |
Kojto | 122:f9eeca106725 | 355 | */ |
Kojto | 122:f9eeca106725 | 356 | __STATIC_INLINE void LL_LPTIM_Enable(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 357 | { |
Kojto | 122:f9eeca106725 | 358 | SET_BIT(LPTIMx->CR, LPTIM_CR_ENABLE); |
Kojto | 122:f9eeca106725 | 359 | } |
Kojto | 122:f9eeca106725 | 360 | |
Kojto | 122:f9eeca106725 | 361 | /** |
Kojto | 122:f9eeca106725 | 362 | * @brief Disable the LPTIM instance |
Kojto | 122:f9eeca106725 | 363 | * @rmtoll CR ENABLE LL_LPTIM_Disable |
Kojto | 122:f9eeca106725 | 364 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 365 | * @retval None |
Kojto | 122:f9eeca106725 | 366 | */ |
Kojto | 122:f9eeca106725 | 367 | __STATIC_INLINE void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 368 | { |
Kojto | 122:f9eeca106725 | 369 | CLEAR_BIT(LPTIMx->CR, LPTIM_CR_ENABLE); |
Kojto | 122:f9eeca106725 | 370 | } |
Kojto | 122:f9eeca106725 | 371 | |
Kojto | 122:f9eeca106725 | 372 | /** |
Kojto | 122:f9eeca106725 | 373 | * @brief Indicates whether the LPTIM instance is enabled. |
Kojto | 122:f9eeca106725 | 374 | * @rmtoll CR ENABLE LL_LPTIM_IsEnabled |
Kojto | 122:f9eeca106725 | 375 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 376 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 377 | */ |
Kojto | 122:f9eeca106725 | 378 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabled(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 379 | { |
Kojto | 122:f9eeca106725 | 380 | return (READ_BIT(LPTIMx->CR, LPTIM_CR_ENABLE) == (LPTIM_CR_ENABLE)); |
Kojto | 122:f9eeca106725 | 381 | } |
Kojto | 122:f9eeca106725 | 382 | |
Kojto | 122:f9eeca106725 | 383 | /** |
Kojto | 122:f9eeca106725 | 384 | * @brief Starts the LPTIM counter in the desired mode. |
Kojto | 122:f9eeca106725 | 385 | * @note LPTIM instance must be enabled before starting the counter. |
Kojto | 122:f9eeca106725 | 386 | * @note It is possible to change on the fly from One Shot mode to |
Kojto | 122:f9eeca106725 | 387 | * Continuous mode. |
Kojto | 122:f9eeca106725 | 388 | * @rmtoll CR CNTSTRT LL_LPTIM_StartCounter\n |
Kojto | 122:f9eeca106725 | 389 | * CR SNGSTRT LL_LPTIM_StartCounter |
Kojto | 122:f9eeca106725 | 390 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 391 | * @param OperatingMode This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 392 | * @arg @ref LL_LPTIM_OPERATING_MODE_CONTINUOUS |
Kojto | 122:f9eeca106725 | 393 | * @arg @ref LL_LPTIM_OPERATING_MODE_ONESHOT |
Kojto | 122:f9eeca106725 | 394 | * @retval None |
Kojto | 122:f9eeca106725 | 395 | */ |
Kojto | 122:f9eeca106725 | 396 | __STATIC_INLINE void LL_LPTIM_StartCounter(LPTIM_TypeDef *LPTIMx, uint32_t OperatingMode) |
Kojto | 122:f9eeca106725 | 397 | { |
Kojto | 122:f9eeca106725 | 398 | MODIFY_REG(LPTIMx->CR, LPTIM_CR_CNTSTRT | LPTIM_CR_SNGSTRT, OperatingMode); |
Kojto | 122:f9eeca106725 | 399 | } |
Kojto | 122:f9eeca106725 | 400 | |
AnnaBridge | 145:64910690c574 | 401 | |
Kojto | 122:f9eeca106725 | 402 | /** |
Kojto | 122:f9eeca106725 | 403 | * @brief Set the LPTIM registers update mode (enable/disable register preload) |
Kojto | 122:f9eeca106725 | 404 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 405 | * @rmtoll CFGR PRELOAD LL_LPTIM_SetUpdateMode |
Kojto | 122:f9eeca106725 | 406 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 407 | * @param UpdateMode This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 408 | * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE |
Kojto | 122:f9eeca106725 | 409 | * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD |
Kojto | 122:f9eeca106725 | 410 | * @retval None |
Kojto | 122:f9eeca106725 | 411 | */ |
Kojto | 122:f9eeca106725 | 412 | __STATIC_INLINE void LL_LPTIM_SetUpdateMode(LPTIM_TypeDef *LPTIMx, uint32_t UpdateMode) |
Kojto | 122:f9eeca106725 | 413 | { |
Kojto | 122:f9eeca106725 | 414 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD, UpdateMode); |
Kojto | 122:f9eeca106725 | 415 | } |
Kojto | 122:f9eeca106725 | 416 | |
Kojto | 122:f9eeca106725 | 417 | /** |
Kojto | 122:f9eeca106725 | 418 | * @brief Get the LPTIM registers update mode |
Kojto | 122:f9eeca106725 | 419 | * @rmtoll CFGR PRELOAD LL_LPTIM_GetUpdateMode |
Kojto | 122:f9eeca106725 | 420 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 421 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 422 | * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE |
Kojto | 122:f9eeca106725 | 423 | * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD |
Kojto | 122:f9eeca106725 | 424 | */ |
Kojto | 122:f9eeca106725 | 425 | __STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 426 | { |
Kojto | 122:f9eeca106725 | 427 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD)); |
Kojto | 122:f9eeca106725 | 428 | } |
Kojto | 122:f9eeca106725 | 429 | |
Kojto | 122:f9eeca106725 | 430 | /** |
Kojto | 122:f9eeca106725 | 431 | * @brief Set the auto reload value |
Kojto | 122:f9eeca106725 | 432 | * @note The LPTIMx_ARR register content must only be modified when the LPTIM is enabled |
Kojto | 122:f9eeca106725 | 433 | * @note After a write to the LPTIMx_ARR register a new write operation to the |
Kojto | 122:f9eeca106725 | 434 | * same register can only be performed when the previous write operation |
Kojto | 122:f9eeca106725 | 435 | * is completed. Any successive write before the ARROK flag be set, will |
Kojto | 122:f9eeca106725 | 436 | * lead to unpredictable results. |
Kojto | 122:f9eeca106725 | 437 | * @note autoreload value be strictly greater than the compare value. |
Kojto | 122:f9eeca106725 | 438 | * @rmtoll ARR ARR LL_LPTIM_SetAutoReload |
Kojto | 122:f9eeca106725 | 439 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 440 | * @param AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF |
Kojto | 122:f9eeca106725 | 441 | * @retval None |
Kojto | 122:f9eeca106725 | 442 | */ |
Kojto | 122:f9eeca106725 | 443 | __STATIC_INLINE void LL_LPTIM_SetAutoReload(LPTIM_TypeDef *LPTIMx, uint32_t AutoReload) |
Kojto | 122:f9eeca106725 | 444 | { |
Kojto | 122:f9eeca106725 | 445 | MODIFY_REG(LPTIMx->ARR, LPTIM_ARR_ARR, AutoReload); |
Kojto | 122:f9eeca106725 | 446 | } |
Kojto | 122:f9eeca106725 | 447 | |
Kojto | 122:f9eeca106725 | 448 | /** |
Kojto | 122:f9eeca106725 | 449 | * @brief Get actual auto reload value |
Kojto | 122:f9eeca106725 | 450 | * @rmtoll ARR ARR LL_LPTIM_GetAutoReload |
Kojto | 122:f9eeca106725 | 451 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 452 | * @retval AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF |
Kojto | 122:f9eeca106725 | 453 | */ |
Kojto | 122:f9eeca106725 | 454 | __STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 455 | { |
Kojto | 122:f9eeca106725 | 456 | return (uint32_t)(READ_BIT(LPTIMx->ARR, LPTIM_ARR_ARR)); |
Kojto | 122:f9eeca106725 | 457 | } |
Kojto | 122:f9eeca106725 | 458 | |
Kojto | 122:f9eeca106725 | 459 | /** |
Kojto | 122:f9eeca106725 | 460 | * @brief Set the compare value |
Kojto | 122:f9eeca106725 | 461 | * @note After a write to the LPTIMx_CMP register a new write operation to the |
Kojto | 122:f9eeca106725 | 462 | * same register can only be performed when the previous write operation |
Kojto | 122:f9eeca106725 | 463 | * is completed. Any successive write before the CMPOK flag be set, will |
Kojto | 122:f9eeca106725 | 464 | * lead to unpredictable results. |
Kojto | 122:f9eeca106725 | 465 | * @rmtoll CMP CMP LL_LPTIM_SetCompare |
Kojto | 122:f9eeca106725 | 466 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 467 | * @param CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF |
Kojto | 122:f9eeca106725 | 468 | * @retval None |
Kojto | 122:f9eeca106725 | 469 | */ |
Kojto | 122:f9eeca106725 | 470 | __STATIC_INLINE void LL_LPTIM_SetCompare(LPTIM_TypeDef *LPTIMx, uint32_t CompareValue) |
Kojto | 122:f9eeca106725 | 471 | { |
Kojto | 122:f9eeca106725 | 472 | MODIFY_REG(LPTIMx->CMP, LPTIM_CMP_CMP, CompareValue); |
Kojto | 122:f9eeca106725 | 473 | } |
Kojto | 122:f9eeca106725 | 474 | |
Kojto | 122:f9eeca106725 | 475 | /** |
Kojto | 122:f9eeca106725 | 476 | * @brief Get actual compare value |
Kojto | 122:f9eeca106725 | 477 | * @rmtoll CMP CMP LL_LPTIM_GetCompare |
Kojto | 122:f9eeca106725 | 478 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 479 | * @retval CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF |
Kojto | 122:f9eeca106725 | 480 | */ |
Kojto | 122:f9eeca106725 | 481 | __STATIC_INLINE uint32_t LL_LPTIM_GetCompare(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 482 | { |
Kojto | 122:f9eeca106725 | 483 | return (uint32_t)(READ_BIT(LPTIMx->CMP, LPTIM_CMP_CMP)); |
Kojto | 122:f9eeca106725 | 484 | } |
Kojto | 122:f9eeca106725 | 485 | |
Kojto | 122:f9eeca106725 | 486 | /** |
Kojto | 122:f9eeca106725 | 487 | * @brief Get actual counter value |
Kojto | 122:f9eeca106725 | 488 | * @note When the LPTIM instance is running with an asynchronous clock, reading |
Kojto | 122:f9eeca106725 | 489 | * the LPTIMx_CNT register may return unreliable values. So in this case |
Kojto | 122:f9eeca106725 | 490 | * it is necessary to perform two consecutive read accesses and verify |
Kojto | 122:f9eeca106725 | 491 | * that the two returned values are identical. |
Kojto | 122:f9eeca106725 | 492 | * @rmtoll CNT CNT LL_LPTIM_GetCounter |
Kojto | 122:f9eeca106725 | 493 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 494 | * @retval Counter value |
Kojto | 122:f9eeca106725 | 495 | */ |
Kojto | 122:f9eeca106725 | 496 | __STATIC_INLINE uint32_t LL_LPTIM_GetCounter(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 497 | { |
Kojto | 122:f9eeca106725 | 498 | return (uint32_t)(READ_BIT(LPTIMx->CNT, LPTIM_CNT_CNT)); |
Kojto | 122:f9eeca106725 | 499 | } |
Kojto | 122:f9eeca106725 | 500 | |
Kojto | 122:f9eeca106725 | 501 | /** |
Kojto | 122:f9eeca106725 | 502 | * @brief Set the counter mode (selection of the LPTIM counter clock source). |
Kojto | 122:f9eeca106725 | 503 | * @note The counter mode can be set only when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 504 | * @rmtoll CFGR COUNTMODE LL_LPTIM_SetCounterMode |
Kojto | 122:f9eeca106725 | 505 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 506 | * @param CounterMode This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 507 | * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL |
Kojto | 122:f9eeca106725 | 508 | * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL |
Kojto | 122:f9eeca106725 | 509 | * @retval None |
Kojto | 122:f9eeca106725 | 510 | */ |
Kojto | 122:f9eeca106725 | 511 | __STATIC_INLINE void LL_LPTIM_SetCounterMode(LPTIM_TypeDef *LPTIMx, uint32_t CounterMode) |
Kojto | 122:f9eeca106725 | 512 | { |
Kojto | 122:f9eeca106725 | 513 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE, CounterMode); |
Kojto | 122:f9eeca106725 | 514 | } |
Kojto | 122:f9eeca106725 | 515 | |
Kojto | 122:f9eeca106725 | 516 | /** |
Kojto | 122:f9eeca106725 | 517 | * @brief Get the counter mode |
Kojto | 122:f9eeca106725 | 518 | * @rmtoll CFGR COUNTMODE LL_LPTIM_GetCounterMode |
Kojto | 122:f9eeca106725 | 519 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 520 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 521 | * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL |
Kojto | 122:f9eeca106725 | 522 | * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL |
Kojto | 122:f9eeca106725 | 523 | */ |
Kojto | 122:f9eeca106725 | 524 | __STATIC_INLINE uint32_t LL_LPTIM_GetCounterMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 525 | { |
Kojto | 122:f9eeca106725 | 526 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE)); |
Kojto | 122:f9eeca106725 | 527 | } |
Kojto | 122:f9eeca106725 | 528 | |
Kojto | 122:f9eeca106725 | 529 | /** |
Kojto | 122:f9eeca106725 | 530 | * @brief Configure the LPTIM instance output (LPTIMx_OUT) |
Kojto | 122:f9eeca106725 | 531 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 532 | * @note Regarding the LPTIM output polarity the change takes effect |
Kojto | 122:f9eeca106725 | 533 | * immediately, so the output default value will change immediately after |
Kojto | 122:f9eeca106725 | 534 | * the polarity is re-configured, even before the timer is enabled. |
Kojto | 122:f9eeca106725 | 535 | * @rmtoll CFGR WAVE LL_LPTIM_ConfigOutput\n |
Kojto | 122:f9eeca106725 | 536 | * CFGR WAVPOL LL_LPTIM_ConfigOutput |
Kojto | 122:f9eeca106725 | 537 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 538 | * @param Waveform This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 539 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM |
Kojto | 122:f9eeca106725 | 540 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE |
Kojto | 122:f9eeca106725 | 541 | * @param Polarity This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 542 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR |
Kojto | 122:f9eeca106725 | 543 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE |
Kojto | 122:f9eeca106725 | 544 | * @retval None |
Kojto | 122:f9eeca106725 | 545 | */ |
Kojto | 122:f9eeca106725 | 546 | __STATIC_INLINE void LL_LPTIM_ConfigOutput(LPTIM_TypeDef *LPTIMx, uint32_t Waveform, uint32_t Polarity) |
Kojto | 122:f9eeca106725 | 547 | { |
Kojto | 122:f9eeca106725 | 548 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE | LPTIM_CFGR_WAVPOL, Waveform | Polarity); |
Kojto | 122:f9eeca106725 | 549 | } |
Kojto | 122:f9eeca106725 | 550 | |
Kojto | 122:f9eeca106725 | 551 | /** |
Kojto | 122:f9eeca106725 | 552 | * @brief Set waveform shape |
Kojto | 122:f9eeca106725 | 553 | * @rmtoll CFGR WAVE LL_LPTIM_SetWaveform |
Kojto | 122:f9eeca106725 | 554 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 555 | * @param Waveform This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 556 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM |
Kojto | 122:f9eeca106725 | 557 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE |
Kojto | 122:f9eeca106725 | 558 | * @retval None |
Kojto | 122:f9eeca106725 | 559 | */ |
Kojto | 122:f9eeca106725 | 560 | __STATIC_INLINE void LL_LPTIM_SetWaveform(LPTIM_TypeDef *LPTIMx, uint32_t Waveform) |
Kojto | 122:f9eeca106725 | 561 | { |
Kojto | 122:f9eeca106725 | 562 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE, Waveform); |
Kojto | 122:f9eeca106725 | 563 | } |
Kojto | 122:f9eeca106725 | 564 | |
Kojto | 122:f9eeca106725 | 565 | /** |
Kojto | 122:f9eeca106725 | 566 | * @brief Get actual waveform shape |
Kojto | 122:f9eeca106725 | 567 | * @rmtoll CFGR WAVE LL_LPTIM_GetWaveform |
Kojto | 122:f9eeca106725 | 568 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 569 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 570 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM |
Kojto | 122:f9eeca106725 | 571 | * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE |
Kojto | 122:f9eeca106725 | 572 | */ |
Kojto | 122:f9eeca106725 | 573 | __STATIC_INLINE uint32_t LL_LPTIM_GetWaveform(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 574 | { |
Kojto | 122:f9eeca106725 | 575 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVE)); |
Kojto | 122:f9eeca106725 | 576 | } |
Kojto | 122:f9eeca106725 | 577 | |
Kojto | 122:f9eeca106725 | 578 | /** |
Kojto | 122:f9eeca106725 | 579 | * @brief Set output polarity |
Kojto | 122:f9eeca106725 | 580 | * @rmtoll CFGR WAVPOL LL_LPTIM_SetPolarity |
Kojto | 122:f9eeca106725 | 581 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 582 | * @param Polarity This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 583 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR |
Kojto | 122:f9eeca106725 | 584 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE |
Kojto | 122:f9eeca106725 | 585 | * @retval None |
Kojto | 122:f9eeca106725 | 586 | */ |
Kojto | 122:f9eeca106725 | 587 | __STATIC_INLINE void LL_LPTIM_SetPolarity(LPTIM_TypeDef *LPTIMx, uint32_t Polarity) |
Kojto | 122:f9eeca106725 | 588 | { |
Kojto | 122:f9eeca106725 | 589 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL, Polarity); |
Kojto | 122:f9eeca106725 | 590 | } |
Kojto | 122:f9eeca106725 | 591 | |
Kojto | 122:f9eeca106725 | 592 | /** |
Kojto | 122:f9eeca106725 | 593 | * @brief Get actual output polarity |
Kojto | 122:f9eeca106725 | 594 | * @rmtoll CFGR WAVPOL LL_LPTIM_GetPolarity |
Kojto | 122:f9eeca106725 | 595 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 596 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 597 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR |
Kojto | 122:f9eeca106725 | 598 | * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE |
Kojto | 122:f9eeca106725 | 599 | */ |
Kojto | 122:f9eeca106725 | 600 | __STATIC_INLINE uint32_t LL_LPTIM_GetPolarity(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 601 | { |
Kojto | 122:f9eeca106725 | 602 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL)); |
Kojto | 122:f9eeca106725 | 603 | } |
Kojto | 122:f9eeca106725 | 604 | |
Kojto | 122:f9eeca106725 | 605 | /** |
Kojto | 122:f9eeca106725 | 606 | * @brief Set actual prescaler division ratio. |
Kojto | 122:f9eeca106725 | 607 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 608 | * @note When the LPTIM is configured to be clocked by an internal clock source |
Kojto | 122:f9eeca106725 | 609 | * and the LPTIM counter is configured to be updated by active edges |
Kojto | 122:f9eeca106725 | 610 | * detected on the LPTIM external Input1, the internal clock provided to |
Kojto | 122:f9eeca106725 | 611 | * the LPTIM must be not be prescaled. |
Kojto | 122:f9eeca106725 | 612 | * @rmtoll CFGR PRESC LL_LPTIM_SetPrescaler |
Kojto | 122:f9eeca106725 | 613 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 614 | * @param Prescaler This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 615 | * @arg @ref LL_LPTIM_PRESCALER_DIV1 |
Kojto | 122:f9eeca106725 | 616 | * @arg @ref LL_LPTIM_PRESCALER_DIV2 |
Kojto | 122:f9eeca106725 | 617 | * @arg @ref LL_LPTIM_PRESCALER_DIV4 |
Kojto | 122:f9eeca106725 | 618 | * @arg @ref LL_LPTIM_PRESCALER_DIV8 |
Kojto | 122:f9eeca106725 | 619 | * @arg @ref LL_LPTIM_PRESCALER_DIV16 |
Kojto | 122:f9eeca106725 | 620 | * @arg @ref LL_LPTIM_PRESCALER_DIV32 |
Kojto | 122:f9eeca106725 | 621 | * @arg @ref LL_LPTIM_PRESCALER_DIV64 |
Kojto | 122:f9eeca106725 | 622 | * @arg @ref LL_LPTIM_PRESCALER_DIV128 |
Kojto | 122:f9eeca106725 | 623 | * @retval None |
Kojto | 122:f9eeca106725 | 624 | */ |
Kojto | 122:f9eeca106725 | 625 | __STATIC_INLINE void LL_LPTIM_SetPrescaler(LPTIM_TypeDef *LPTIMx, uint32_t Prescaler) |
Kojto | 122:f9eeca106725 | 626 | { |
Kojto | 122:f9eeca106725 | 627 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRESC, Prescaler); |
Kojto | 122:f9eeca106725 | 628 | } |
Kojto | 122:f9eeca106725 | 629 | |
Kojto | 122:f9eeca106725 | 630 | /** |
Kojto | 122:f9eeca106725 | 631 | * @brief Get actual prescaler division ratio. |
Kojto | 122:f9eeca106725 | 632 | * @rmtoll CFGR PRESC LL_LPTIM_GetPrescaler |
Kojto | 122:f9eeca106725 | 633 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 634 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 635 | * @arg @ref LL_LPTIM_PRESCALER_DIV1 |
Kojto | 122:f9eeca106725 | 636 | * @arg @ref LL_LPTIM_PRESCALER_DIV2 |
Kojto | 122:f9eeca106725 | 637 | * @arg @ref LL_LPTIM_PRESCALER_DIV4 |
Kojto | 122:f9eeca106725 | 638 | * @arg @ref LL_LPTIM_PRESCALER_DIV8 |
Kojto | 122:f9eeca106725 | 639 | * @arg @ref LL_LPTIM_PRESCALER_DIV16 |
Kojto | 122:f9eeca106725 | 640 | * @arg @ref LL_LPTIM_PRESCALER_DIV32 |
Kojto | 122:f9eeca106725 | 641 | * @arg @ref LL_LPTIM_PRESCALER_DIV64 |
Kojto | 122:f9eeca106725 | 642 | * @arg @ref LL_LPTIM_PRESCALER_DIV128 |
Kojto | 122:f9eeca106725 | 643 | */ |
Kojto | 122:f9eeca106725 | 644 | __STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 645 | { |
Kojto | 122:f9eeca106725 | 646 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRESC)); |
Kojto | 122:f9eeca106725 | 647 | } |
Kojto | 122:f9eeca106725 | 648 | |
Kojto | 122:f9eeca106725 | 649 | /** |
Kojto | 122:f9eeca106725 | 650 | * @brief Set LPTIM input 1 source (default GPIO). |
Kojto | 122:f9eeca106725 | 651 | * @rmtoll OR OR_0 LL_LPTIM_SetInput1Src |
Kojto | 122:f9eeca106725 | 652 | * @rmtoll OR OR_1 LL_LPTIM_SetInput1Src |
Kojto | 122:f9eeca106725 | 653 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 654 | * @param Src This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 655 | * @arg @ref LL_LPTIM_INPUT1_SRC_GPIO |
Kojto | 122:f9eeca106725 | 656 | * @arg @ref LL_LPTIM_INPUT1_SRC_COMP1 |
Kojto | 122:f9eeca106725 | 657 | * @arg @ref LL_LPTIM_INPUT1_SRC_COMP2 |
Kojto | 122:f9eeca106725 | 658 | * @arg @ref LL_LPTIM_INPUT1_SRC_COMP1_COMP2 |
Kojto | 122:f9eeca106725 | 659 | * @retval None |
Kojto | 122:f9eeca106725 | 660 | */ |
Kojto | 122:f9eeca106725 | 661 | __STATIC_INLINE void LL_LPTIM_SetInput1Src(LPTIM_TypeDef *LPTIMx, uint32_t Src) |
Kojto | 122:f9eeca106725 | 662 | { |
Kojto | 122:f9eeca106725 | 663 | WRITE_REG(LPTIMx->OR, Src); |
Kojto | 122:f9eeca106725 | 664 | } |
Kojto | 122:f9eeca106725 | 665 | |
Kojto | 122:f9eeca106725 | 666 | /** |
Kojto | 122:f9eeca106725 | 667 | * @brief Set LPTIM input 2 source (default GPIO). |
Kojto | 122:f9eeca106725 | 668 | * @rmtoll OR OR_0 LL_LPTIM_SetInput2Src |
Kojto | 122:f9eeca106725 | 669 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 670 | * @param Src This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 671 | * @arg @ref LL_LPTIM_INPUT2_SRC_GPIO |
Kojto | 122:f9eeca106725 | 672 | * @arg @ref LL_LPTIM_INPUT2_SRC_COMP2 |
Kojto | 122:f9eeca106725 | 673 | * @retval None |
Kojto | 122:f9eeca106725 | 674 | */ |
Kojto | 122:f9eeca106725 | 675 | __STATIC_INLINE void LL_LPTIM_SetInput2Src(LPTIM_TypeDef *LPTIMx, uint32_t Src) |
Kojto | 122:f9eeca106725 | 676 | { |
Kojto | 122:f9eeca106725 | 677 | WRITE_REG(LPTIMx->OR, Src); |
Kojto | 122:f9eeca106725 | 678 | } |
Kojto | 122:f9eeca106725 | 679 | |
Kojto | 122:f9eeca106725 | 680 | /** |
Kojto | 122:f9eeca106725 | 681 | * @} |
Kojto | 122:f9eeca106725 | 682 | */ |
Kojto | 122:f9eeca106725 | 683 | |
Kojto | 122:f9eeca106725 | 684 | /** @defgroup LPTIM_LL_EF_Trigger_Configuration Trigger Configuration |
Kojto | 122:f9eeca106725 | 685 | * @{ |
Kojto | 122:f9eeca106725 | 686 | */ |
Kojto | 122:f9eeca106725 | 687 | |
Kojto | 122:f9eeca106725 | 688 | /** |
Kojto | 122:f9eeca106725 | 689 | * @brief Enable the timeout function |
Kojto | 122:f9eeca106725 | 690 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 691 | * @note The first trigger event will start the timer, any successive trigger |
Kojto | 122:f9eeca106725 | 692 | * event will reset the counter and the timer will restart. |
Kojto | 122:f9eeca106725 | 693 | * @note The timeout value corresponds to the compare value; if no trigger |
Kojto | 122:f9eeca106725 | 694 | * occurs within the expected time frame, the MCU is waked-up by the |
Kojto | 122:f9eeca106725 | 695 | * compare match event. |
Kojto | 122:f9eeca106725 | 696 | * @rmtoll CFGR TIMOUT LL_LPTIM_EnableTimeout |
Kojto | 122:f9eeca106725 | 697 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 698 | * @retval None |
Kojto | 122:f9eeca106725 | 699 | */ |
Kojto | 122:f9eeca106725 | 700 | __STATIC_INLINE void LL_LPTIM_EnableTimeout(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 701 | { |
Kojto | 122:f9eeca106725 | 702 | SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT); |
Kojto | 122:f9eeca106725 | 703 | } |
Kojto | 122:f9eeca106725 | 704 | |
Kojto | 122:f9eeca106725 | 705 | /** |
Kojto | 122:f9eeca106725 | 706 | * @brief Disable the timeout function |
Kojto | 122:f9eeca106725 | 707 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 708 | * @note A trigger event arriving when the timer is already started will be |
Kojto | 122:f9eeca106725 | 709 | * ignored. |
Kojto | 122:f9eeca106725 | 710 | * @rmtoll CFGR TIMOUT LL_LPTIM_DisableTimeout |
Kojto | 122:f9eeca106725 | 711 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 712 | * @retval None |
Kojto | 122:f9eeca106725 | 713 | */ |
Kojto | 122:f9eeca106725 | 714 | __STATIC_INLINE void LL_LPTIM_DisableTimeout(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 715 | { |
Kojto | 122:f9eeca106725 | 716 | CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT); |
Kojto | 122:f9eeca106725 | 717 | } |
Kojto | 122:f9eeca106725 | 718 | |
Kojto | 122:f9eeca106725 | 719 | /** |
Kojto | 122:f9eeca106725 | 720 | * @brief Indicate whether the timeout function is enabled. |
Kojto | 122:f9eeca106725 | 721 | * @rmtoll CFGR TIMOUT LL_LPTIM_IsEnabledTimeout |
Kojto | 122:f9eeca106725 | 722 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 723 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 724 | */ |
Kojto | 122:f9eeca106725 | 725 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledTimeout(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 726 | { |
Kojto | 122:f9eeca106725 | 727 | return (READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT) == (LPTIM_CFGR_TIMOUT)); |
Kojto | 122:f9eeca106725 | 728 | } |
Kojto | 122:f9eeca106725 | 729 | |
Kojto | 122:f9eeca106725 | 730 | /** |
Kojto | 122:f9eeca106725 | 731 | * @brief Start the LPTIM counter |
Kojto | 122:f9eeca106725 | 732 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 733 | * @rmtoll CFGR TRIGEN LL_LPTIM_TrigSw |
Kojto | 122:f9eeca106725 | 734 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 735 | * @retval None |
Kojto | 122:f9eeca106725 | 736 | */ |
Kojto | 122:f9eeca106725 | 737 | __STATIC_INLINE void LL_LPTIM_TrigSw(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 738 | { |
Kojto | 122:f9eeca106725 | 739 | CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN); |
Kojto | 122:f9eeca106725 | 740 | } |
Kojto | 122:f9eeca106725 | 741 | |
Kojto | 122:f9eeca106725 | 742 | /** |
Kojto | 122:f9eeca106725 | 743 | * @brief Configure the external trigger used as a trigger event for the LPTIM. |
Kojto | 122:f9eeca106725 | 744 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 745 | * @note An internal clock source must be present when a digital filter is |
Kojto | 122:f9eeca106725 | 746 | * required for the trigger. |
Kojto | 122:f9eeca106725 | 747 | * @rmtoll CFGR TRIGSEL LL_LPTIM_ConfigTrigger\n |
Kojto | 122:f9eeca106725 | 748 | * CFGR TRGFLT LL_LPTIM_ConfigTrigger\n |
Kojto | 122:f9eeca106725 | 749 | * CFGR TRIGEN LL_LPTIM_ConfigTrigger |
Kojto | 122:f9eeca106725 | 750 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 751 | * @param Source This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 752 | * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO |
Kojto | 122:f9eeca106725 | 753 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA |
Kojto | 122:f9eeca106725 | 754 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB |
Kojto | 122:f9eeca106725 | 755 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1 |
Kojto | 122:f9eeca106725 | 756 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP2 |
Kojto | 122:f9eeca106725 | 757 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP3 |
Kojto | 122:f9eeca106725 | 758 | * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP1 |
Kojto | 122:f9eeca106725 | 759 | * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP2 |
Kojto | 122:f9eeca106725 | 760 | * @param Filter This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 761 | * @arg @ref LL_LPTIM_TRIG_FILTER_NONE |
Kojto | 122:f9eeca106725 | 762 | * @arg @ref LL_LPTIM_TRIG_FILTER_2 |
Kojto | 122:f9eeca106725 | 763 | * @arg @ref LL_LPTIM_TRIG_FILTER_4 |
Kojto | 122:f9eeca106725 | 764 | * @arg @ref LL_LPTIM_TRIG_FILTER_8 |
Kojto | 122:f9eeca106725 | 765 | * @param Polarity This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 766 | * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING |
Kojto | 122:f9eeca106725 | 767 | * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING |
Kojto | 122:f9eeca106725 | 768 | * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING |
Kojto | 122:f9eeca106725 | 769 | * @retval None |
Kojto | 122:f9eeca106725 | 770 | */ |
Kojto | 122:f9eeca106725 | 771 | __STATIC_INLINE void LL_LPTIM_ConfigTrigger(LPTIM_TypeDef *LPTIMx, uint32_t Source, uint32_t Filter, uint32_t Polarity) |
Kojto | 122:f9eeca106725 | 772 | { |
Kojto | 122:f9eeca106725 | 773 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL | LPTIM_CFGR_TRGFLT | LPTIM_CFGR_TRIGEN, Source | Filter | Polarity); |
Kojto | 122:f9eeca106725 | 774 | } |
Kojto | 122:f9eeca106725 | 775 | |
Kojto | 122:f9eeca106725 | 776 | /** |
Kojto | 122:f9eeca106725 | 777 | * @brief Get actual external trigger source. |
Kojto | 122:f9eeca106725 | 778 | * @rmtoll CFGR TRIGSEL LL_LPTIM_GetTriggerSource |
Kojto | 122:f9eeca106725 | 779 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 780 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 781 | * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO |
Kojto | 122:f9eeca106725 | 782 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA |
Kojto | 122:f9eeca106725 | 783 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB |
Kojto | 122:f9eeca106725 | 784 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1 |
Kojto | 122:f9eeca106725 | 785 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP2 |
Kojto | 122:f9eeca106725 | 786 | * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP3 |
Kojto | 122:f9eeca106725 | 787 | * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP1 |
Kojto | 122:f9eeca106725 | 788 | * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP2 |
Kojto | 122:f9eeca106725 | 789 | */ |
Kojto | 122:f9eeca106725 | 790 | __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerSource(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 791 | { |
Kojto | 122:f9eeca106725 | 792 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL)); |
Kojto | 122:f9eeca106725 | 793 | } |
Kojto | 122:f9eeca106725 | 794 | |
Kojto | 122:f9eeca106725 | 795 | /** |
Kojto | 122:f9eeca106725 | 796 | * @brief Get actual external trigger filter. |
Kojto | 122:f9eeca106725 | 797 | * @rmtoll CFGR TRGFLT LL_LPTIM_GetTriggerFilter |
Kojto | 122:f9eeca106725 | 798 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 799 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 800 | * @arg @ref LL_LPTIM_TRIG_FILTER_NONE |
Kojto | 122:f9eeca106725 | 801 | * @arg @ref LL_LPTIM_TRIG_FILTER_2 |
Kojto | 122:f9eeca106725 | 802 | * @arg @ref LL_LPTIM_TRIG_FILTER_4 |
Kojto | 122:f9eeca106725 | 803 | * @arg @ref LL_LPTIM_TRIG_FILTER_8 |
Kojto | 122:f9eeca106725 | 804 | */ |
Kojto | 122:f9eeca106725 | 805 | __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerFilter(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 806 | { |
Kojto | 122:f9eeca106725 | 807 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRGFLT)); |
Kojto | 122:f9eeca106725 | 808 | } |
Kojto | 122:f9eeca106725 | 809 | |
Kojto | 122:f9eeca106725 | 810 | /** |
Kojto | 122:f9eeca106725 | 811 | * @brief Get actual external trigger polarity. |
Kojto | 122:f9eeca106725 | 812 | * @rmtoll CFGR TRIGEN LL_LPTIM_GetTriggerPolarity |
Kojto | 122:f9eeca106725 | 813 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 814 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 815 | * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING |
Kojto | 122:f9eeca106725 | 816 | * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING |
Kojto | 122:f9eeca106725 | 817 | * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING |
Kojto | 122:f9eeca106725 | 818 | */ |
Kojto | 122:f9eeca106725 | 819 | __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerPolarity(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 820 | { |
Kojto | 122:f9eeca106725 | 821 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN)); |
Kojto | 122:f9eeca106725 | 822 | } |
Kojto | 122:f9eeca106725 | 823 | |
Kojto | 122:f9eeca106725 | 824 | /** |
Kojto | 122:f9eeca106725 | 825 | * @} |
Kojto | 122:f9eeca106725 | 826 | */ |
Kojto | 122:f9eeca106725 | 827 | |
Kojto | 122:f9eeca106725 | 828 | /** @defgroup LPTIM_LL_EF_Clock_Configuration Clock Configuration |
Kojto | 122:f9eeca106725 | 829 | * @{ |
Kojto | 122:f9eeca106725 | 830 | */ |
Kojto | 122:f9eeca106725 | 831 | |
Kojto | 122:f9eeca106725 | 832 | /** |
Kojto | 122:f9eeca106725 | 833 | * @brief Set the source of the clock used by the LPTIM instance. |
Kojto | 122:f9eeca106725 | 834 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 835 | * @rmtoll CFGR CKSEL LL_LPTIM_SetClockSource |
Kojto | 122:f9eeca106725 | 836 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 837 | * @param ClockSource This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 838 | * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL |
Kojto | 122:f9eeca106725 | 839 | * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL |
Kojto | 122:f9eeca106725 | 840 | * @retval None |
Kojto | 122:f9eeca106725 | 841 | */ |
Kojto | 122:f9eeca106725 | 842 | __STATIC_INLINE void LL_LPTIM_SetClockSource(LPTIM_TypeDef *LPTIMx, uint32_t ClockSource) |
Kojto | 122:f9eeca106725 | 843 | { |
Kojto | 122:f9eeca106725 | 844 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKSEL, ClockSource); |
Kojto | 122:f9eeca106725 | 845 | } |
Kojto | 122:f9eeca106725 | 846 | |
Kojto | 122:f9eeca106725 | 847 | /** |
Kojto | 122:f9eeca106725 | 848 | * @brief Get actual LPTIM instance clock source. |
Kojto | 122:f9eeca106725 | 849 | * @rmtoll CFGR CKSEL LL_LPTIM_GetClockSource |
Kojto | 122:f9eeca106725 | 850 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 851 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 852 | * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL |
Kojto | 122:f9eeca106725 | 853 | * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL |
Kojto | 122:f9eeca106725 | 854 | */ |
Kojto | 122:f9eeca106725 | 855 | __STATIC_INLINE uint32_t LL_LPTIM_GetClockSource(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 856 | { |
Kojto | 122:f9eeca106725 | 857 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKSEL)); |
Kojto | 122:f9eeca106725 | 858 | } |
Kojto | 122:f9eeca106725 | 859 | |
Kojto | 122:f9eeca106725 | 860 | /** |
Kojto | 122:f9eeca106725 | 861 | * @brief Configure the active edge or edges used by the counter when the LPTIM is clocked by an external clock source. |
Kojto | 122:f9eeca106725 | 862 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 863 | * @note When both external clock signal edges are considered active ones, |
Kojto | 122:f9eeca106725 | 864 | * the LPTIM must also be clocked by an internal clock source with a |
Kojto | 122:f9eeca106725 | 865 | * frequency equal to at least four times the external clock frequency. |
Kojto | 122:f9eeca106725 | 866 | * @note An internal clock source must be present when a digital filter is |
Kojto | 122:f9eeca106725 | 867 | * required for external clock. |
Kojto | 122:f9eeca106725 | 868 | * @rmtoll CFGR CKFLT LL_LPTIM_ConfigClock\n |
Kojto | 122:f9eeca106725 | 869 | * CFGR CKPOL LL_LPTIM_ConfigClock |
Kojto | 122:f9eeca106725 | 870 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 871 | * @param ClockFilter This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 872 | * @arg @ref LL_LPTIM_CLK_FILTER_NONE |
Kojto | 122:f9eeca106725 | 873 | * @arg @ref LL_LPTIM_CLK_FILTER_2 |
Kojto | 122:f9eeca106725 | 874 | * @arg @ref LL_LPTIM_CLK_FILTER_4 |
Kojto | 122:f9eeca106725 | 875 | * @arg @ref LL_LPTIM_CLK_FILTER_8 |
Kojto | 122:f9eeca106725 | 876 | * @param ClockPolarity This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 877 | * @arg @ref LL_LPTIM_CLK_POLARITY_RISING |
Kojto | 122:f9eeca106725 | 878 | * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING |
Kojto | 122:f9eeca106725 | 879 | * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING |
Kojto | 122:f9eeca106725 | 880 | * @retval None |
Kojto | 122:f9eeca106725 | 881 | */ |
Kojto | 122:f9eeca106725 | 882 | __STATIC_INLINE void LL_LPTIM_ConfigClock(LPTIM_TypeDef *LPTIMx, uint32_t ClockFilter, uint32_t ClockPolarity) |
Kojto | 122:f9eeca106725 | 883 | { |
Kojto | 122:f9eeca106725 | 884 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKFLT | LPTIM_CFGR_CKPOL, ClockFilter | ClockPolarity); |
Kojto | 122:f9eeca106725 | 885 | } |
Kojto | 122:f9eeca106725 | 886 | |
Kojto | 122:f9eeca106725 | 887 | /** |
Kojto | 122:f9eeca106725 | 888 | * @brief Get actual clock polarity |
Kojto | 122:f9eeca106725 | 889 | * @rmtoll CFGR CKPOL LL_LPTIM_GetClockPolarity |
Kojto | 122:f9eeca106725 | 890 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 891 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 892 | * @arg @ref LL_LPTIM_CLK_POLARITY_RISING |
Kojto | 122:f9eeca106725 | 893 | * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING |
Kojto | 122:f9eeca106725 | 894 | * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING |
Kojto | 122:f9eeca106725 | 895 | */ |
Kojto | 122:f9eeca106725 | 896 | __STATIC_INLINE uint32_t LL_LPTIM_GetClockPolarity(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 897 | { |
Kojto | 122:f9eeca106725 | 898 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL)); |
Kojto | 122:f9eeca106725 | 899 | } |
Kojto | 122:f9eeca106725 | 900 | |
Kojto | 122:f9eeca106725 | 901 | /** |
Kojto | 122:f9eeca106725 | 902 | * @brief Get actual clock digital filter |
Kojto | 122:f9eeca106725 | 903 | * @rmtoll CFGR CKFLT LL_LPTIM_GetClockFilter |
Kojto | 122:f9eeca106725 | 904 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 905 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 906 | * @arg @ref LL_LPTIM_CLK_FILTER_NONE |
Kojto | 122:f9eeca106725 | 907 | * @arg @ref LL_LPTIM_CLK_FILTER_2 |
Kojto | 122:f9eeca106725 | 908 | * @arg @ref LL_LPTIM_CLK_FILTER_4 |
Kojto | 122:f9eeca106725 | 909 | * @arg @ref LL_LPTIM_CLK_FILTER_8 |
Kojto | 122:f9eeca106725 | 910 | */ |
Kojto | 122:f9eeca106725 | 911 | __STATIC_INLINE uint32_t LL_LPTIM_GetClockFilter(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 912 | { |
Kojto | 122:f9eeca106725 | 913 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKFLT)); |
Kojto | 122:f9eeca106725 | 914 | } |
Kojto | 122:f9eeca106725 | 915 | |
Kojto | 122:f9eeca106725 | 916 | /** |
Kojto | 122:f9eeca106725 | 917 | * @} |
Kojto | 122:f9eeca106725 | 918 | */ |
Kojto | 122:f9eeca106725 | 919 | |
Kojto | 122:f9eeca106725 | 920 | /** @defgroup LPTIM_LL_EF_Encoder_Mode Encoder Mode |
Kojto | 122:f9eeca106725 | 921 | * @{ |
Kojto | 122:f9eeca106725 | 922 | */ |
Kojto | 122:f9eeca106725 | 923 | |
Kojto | 122:f9eeca106725 | 924 | /** |
Kojto | 122:f9eeca106725 | 925 | * @brief Configure the encoder mode. |
Kojto | 122:f9eeca106725 | 926 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 927 | * @rmtoll CFGR CKPOL LL_LPTIM_SetEncoderMode |
Kojto | 122:f9eeca106725 | 928 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 929 | * @param EncoderMode This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 930 | * @arg @ref LL_LPTIM_ENCODER_MODE_RISING |
Kojto | 122:f9eeca106725 | 931 | * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING |
Kojto | 122:f9eeca106725 | 932 | * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING |
Kojto | 122:f9eeca106725 | 933 | * @retval None |
Kojto | 122:f9eeca106725 | 934 | */ |
Kojto | 122:f9eeca106725 | 935 | __STATIC_INLINE void LL_LPTIM_SetEncoderMode(LPTIM_TypeDef *LPTIMx, uint32_t EncoderMode) |
Kojto | 122:f9eeca106725 | 936 | { |
Kojto | 122:f9eeca106725 | 937 | MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKPOL, EncoderMode); |
Kojto | 122:f9eeca106725 | 938 | } |
Kojto | 122:f9eeca106725 | 939 | |
Kojto | 122:f9eeca106725 | 940 | /** |
Kojto | 122:f9eeca106725 | 941 | * @brief Get actual encoder mode. |
Kojto | 122:f9eeca106725 | 942 | * @rmtoll CFGR CKPOL LL_LPTIM_GetEncoderMode |
Kojto | 122:f9eeca106725 | 943 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 944 | * @retval Returned value can be one of the following values: |
Kojto | 122:f9eeca106725 | 945 | * @arg @ref LL_LPTIM_ENCODER_MODE_RISING |
Kojto | 122:f9eeca106725 | 946 | * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING |
Kojto | 122:f9eeca106725 | 947 | * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING |
Kojto | 122:f9eeca106725 | 948 | */ |
Kojto | 122:f9eeca106725 | 949 | __STATIC_INLINE uint32_t LL_LPTIM_GetEncoderMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 950 | { |
Kojto | 122:f9eeca106725 | 951 | return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL)); |
Kojto | 122:f9eeca106725 | 952 | } |
Kojto | 122:f9eeca106725 | 953 | |
Kojto | 122:f9eeca106725 | 954 | /** |
Kojto | 122:f9eeca106725 | 955 | * @brief Enable the encoder mode |
Kojto | 122:f9eeca106725 | 956 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 957 | * @note In this mode the LPTIM instance must be clocked by an internal clock |
Kojto | 122:f9eeca106725 | 958 | * source. Also, the prescaler division ratio must be equal to 1. |
Kojto | 122:f9eeca106725 | 959 | * @note LPTIM instance must be configured in continuous mode prior enabling |
Kojto | 122:f9eeca106725 | 960 | * the encoder mode. |
Kojto | 122:f9eeca106725 | 961 | * @rmtoll CFGR ENC LL_LPTIM_EnableEncoderMode |
Kojto | 122:f9eeca106725 | 962 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 963 | * @retval None |
Kojto | 122:f9eeca106725 | 964 | */ |
Kojto | 122:f9eeca106725 | 965 | __STATIC_INLINE void LL_LPTIM_EnableEncoderMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 966 | { |
Kojto | 122:f9eeca106725 | 967 | SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC); |
Kojto | 122:f9eeca106725 | 968 | } |
Kojto | 122:f9eeca106725 | 969 | |
Kojto | 122:f9eeca106725 | 970 | /** |
Kojto | 122:f9eeca106725 | 971 | * @brief Disable the encoder mode |
Kojto | 122:f9eeca106725 | 972 | * @note This function must be called when the LPTIM instance is disabled. |
Kojto | 122:f9eeca106725 | 973 | * @rmtoll CFGR ENC LL_LPTIM_DisableEncoderMode |
Kojto | 122:f9eeca106725 | 974 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 975 | * @retval None |
Kojto | 122:f9eeca106725 | 976 | */ |
Kojto | 122:f9eeca106725 | 977 | __STATIC_INLINE void LL_LPTIM_DisableEncoderMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 978 | { |
Kojto | 122:f9eeca106725 | 979 | CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC); |
Kojto | 122:f9eeca106725 | 980 | } |
Kojto | 122:f9eeca106725 | 981 | |
Kojto | 122:f9eeca106725 | 982 | /** |
Kojto | 122:f9eeca106725 | 983 | * @brief Indicates whether the LPTIM operates in encoder mode. |
Kojto | 122:f9eeca106725 | 984 | * @rmtoll CFGR ENC LL_LPTIM_IsEnabledEncoderMode |
Kojto | 122:f9eeca106725 | 985 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 986 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 987 | */ |
Kojto | 122:f9eeca106725 | 988 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledEncoderMode(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 989 | { |
Kojto | 122:f9eeca106725 | 990 | return (READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC) == (LPTIM_CFGR_ENC)); |
Kojto | 122:f9eeca106725 | 991 | } |
Kojto | 122:f9eeca106725 | 992 | |
Kojto | 122:f9eeca106725 | 993 | /** |
Kojto | 122:f9eeca106725 | 994 | * @} |
Kojto | 122:f9eeca106725 | 995 | */ |
Kojto | 122:f9eeca106725 | 996 | |
Kojto | 122:f9eeca106725 | 997 | /** @defgroup LPTIM_LL_EF_FLAG_Management FLAG Management |
Kojto | 122:f9eeca106725 | 998 | * @{ |
Kojto | 122:f9eeca106725 | 999 | */ |
Kojto | 122:f9eeca106725 | 1000 | |
Kojto | 122:f9eeca106725 | 1001 | /** |
Kojto | 122:f9eeca106725 | 1002 | * @brief Clear the compare match flag (CMPMCF) |
Kojto | 122:f9eeca106725 | 1003 | * @rmtoll ICR CMPMCF LL_LPTIM_ClearFLAG_CMPM |
Kojto | 122:f9eeca106725 | 1004 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1005 | * @retval None |
Kojto | 122:f9eeca106725 | 1006 | */ |
Kojto | 122:f9eeca106725 | 1007 | __STATIC_INLINE void LL_LPTIM_ClearFLAG_CMPM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1008 | { |
Kojto | 122:f9eeca106725 | 1009 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPMCF); |
Kojto | 122:f9eeca106725 | 1010 | } |
Kojto | 122:f9eeca106725 | 1011 | |
Kojto | 122:f9eeca106725 | 1012 | /** |
Kojto | 122:f9eeca106725 | 1013 | * @brief Inform application whether a compare match interrupt has occurred. |
Kojto | 122:f9eeca106725 | 1014 | * @rmtoll ISR CMPM LL_LPTIM_IsActiveFlag_CMPM |
Kojto | 122:f9eeca106725 | 1015 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1016 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1017 | */ |
Kojto | 122:f9eeca106725 | 1018 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1019 | { |
Kojto | 122:f9eeca106725 | 1020 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPM) == (LPTIM_ISR_CMPM)); |
Kojto | 122:f9eeca106725 | 1021 | } |
Kojto | 122:f9eeca106725 | 1022 | |
Kojto | 122:f9eeca106725 | 1023 | /** |
Kojto | 122:f9eeca106725 | 1024 | * @brief Clear the autoreload match flag (ARRMCF) |
Kojto | 122:f9eeca106725 | 1025 | * @rmtoll ICR ARRMCF LL_LPTIM_ClearFLAG_ARRM |
Kojto | 122:f9eeca106725 | 1026 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1027 | * @retval None |
Kojto | 122:f9eeca106725 | 1028 | */ |
Kojto | 122:f9eeca106725 | 1029 | __STATIC_INLINE void LL_LPTIM_ClearFLAG_ARRM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1030 | { |
Kojto | 122:f9eeca106725 | 1031 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARRMCF); |
Kojto | 122:f9eeca106725 | 1032 | } |
Kojto | 122:f9eeca106725 | 1033 | |
Kojto | 122:f9eeca106725 | 1034 | /** |
Kojto | 122:f9eeca106725 | 1035 | * @brief Inform application whether a autoreload match interrupt has occured. |
Kojto | 122:f9eeca106725 | 1036 | * @rmtoll ISR ARRM LL_LPTIM_IsActiveFlag_ARRM |
Kojto | 122:f9eeca106725 | 1037 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1038 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1039 | */ |
Kojto | 122:f9eeca106725 | 1040 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARRM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1041 | { |
Kojto | 122:f9eeca106725 | 1042 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARRM) == (LPTIM_ISR_ARRM)); |
Kojto | 122:f9eeca106725 | 1043 | } |
Kojto | 122:f9eeca106725 | 1044 | |
Kojto | 122:f9eeca106725 | 1045 | /** |
Kojto | 122:f9eeca106725 | 1046 | * @brief Clear the external trigger valid edge flag(EXTTRIGCF). |
Kojto | 122:f9eeca106725 | 1047 | * @rmtoll ICR EXTTRIGCF LL_LPTIM_ClearFlag_EXTTRIG |
Kojto | 122:f9eeca106725 | 1048 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1049 | * @retval None |
Kojto | 122:f9eeca106725 | 1050 | */ |
Kojto | 122:f9eeca106725 | 1051 | __STATIC_INLINE void LL_LPTIM_ClearFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1052 | { |
Kojto | 122:f9eeca106725 | 1053 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_EXTTRIGCF); |
Kojto | 122:f9eeca106725 | 1054 | } |
Kojto | 122:f9eeca106725 | 1055 | |
Kojto | 122:f9eeca106725 | 1056 | /** |
Kojto | 122:f9eeca106725 | 1057 | * @brief Inform application whether a valid edge on the selected external trigger input has occurred. |
Kojto | 122:f9eeca106725 | 1058 | * @rmtoll ISR EXTTRIG LL_LPTIM_IsActiveFlag_EXTTRIG |
Kojto | 122:f9eeca106725 | 1059 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1060 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1061 | */ |
Kojto | 122:f9eeca106725 | 1062 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1063 | { |
Kojto | 122:f9eeca106725 | 1064 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_EXTTRIG) == (LPTIM_ISR_EXTTRIG)); |
Kojto | 122:f9eeca106725 | 1065 | } |
Kojto | 122:f9eeca106725 | 1066 | |
Kojto | 122:f9eeca106725 | 1067 | /** |
Kojto | 122:f9eeca106725 | 1068 | * @brief Clear the compare register update interrupt flag (CMPOKCF). |
Kojto | 122:f9eeca106725 | 1069 | * @rmtoll ICR CMPOKCF LL_LPTIM_ClearFlag_CMPOK |
Kojto | 122:f9eeca106725 | 1070 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1071 | * @retval None |
Kojto | 122:f9eeca106725 | 1072 | */ |
Kojto | 122:f9eeca106725 | 1073 | __STATIC_INLINE void LL_LPTIM_ClearFlag_CMPOK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1074 | { |
Kojto | 122:f9eeca106725 | 1075 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPOKCF); |
Kojto | 122:f9eeca106725 | 1076 | } |
Kojto | 122:f9eeca106725 | 1077 | |
Kojto | 122:f9eeca106725 | 1078 | /** |
Kojto | 122:f9eeca106725 | 1079 | * @brief Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfully completed; If so, a new one can be initiated. |
Kojto | 122:f9eeca106725 | 1080 | * @rmtoll ISR CMPOK LL_LPTIM_IsActiveFlag_CMPOK |
Kojto | 122:f9eeca106725 | 1081 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1082 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1083 | */ |
Kojto | 122:f9eeca106725 | 1084 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPOK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1085 | { |
Kojto | 122:f9eeca106725 | 1086 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPOK) == (LPTIM_ISR_CMPOK)); |
Kojto | 122:f9eeca106725 | 1087 | } |
Kojto | 122:f9eeca106725 | 1088 | |
Kojto | 122:f9eeca106725 | 1089 | /** |
Kojto | 122:f9eeca106725 | 1090 | * @brief Clear the autoreload register update interrupt flag (ARROKCF). |
Kojto | 122:f9eeca106725 | 1091 | * @rmtoll ICR ARROKCF LL_LPTIM_ClearFlag_ARROK |
Kojto | 122:f9eeca106725 | 1092 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1093 | * @retval None |
Kojto | 122:f9eeca106725 | 1094 | */ |
Kojto | 122:f9eeca106725 | 1095 | __STATIC_INLINE void LL_LPTIM_ClearFlag_ARROK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1096 | { |
Kojto | 122:f9eeca106725 | 1097 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARROKCF); |
Kojto | 122:f9eeca106725 | 1098 | } |
Kojto | 122:f9eeca106725 | 1099 | |
Kojto | 122:f9eeca106725 | 1100 | /** |
Kojto | 122:f9eeca106725 | 1101 | * @brief Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfully completed; If so, a new one can be initiated. |
Kojto | 122:f9eeca106725 | 1102 | * @rmtoll ISR ARROK LL_LPTIM_IsActiveFlag_ARROK |
Kojto | 122:f9eeca106725 | 1103 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1104 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1105 | */ |
Kojto | 122:f9eeca106725 | 1106 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARROK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1107 | { |
Kojto | 122:f9eeca106725 | 1108 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARROK) == (LPTIM_ISR_ARROK)); |
Kojto | 122:f9eeca106725 | 1109 | } |
Kojto | 122:f9eeca106725 | 1110 | |
Kojto | 122:f9eeca106725 | 1111 | /** |
Kojto | 122:f9eeca106725 | 1112 | * @brief Clear the counter direction change to up interrupt flag (UPCF). |
Kojto | 122:f9eeca106725 | 1113 | * @rmtoll ICR UPCF LL_LPTIM_ClearFlag_UP |
Kojto | 122:f9eeca106725 | 1114 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1115 | * @retval None |
Kojto | 122:f9eeca106725 | 1116 | */ |
Kojto | 122:f9eeca106725 | 1117 | __STATIC_INLINE void LL_LPTIM_ClearFlag_UP(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1118 | { |
Kojto | 122:f9eeca106725 | 1119 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_UPCF); |
Kojto | 122:f9eeca106725 | 1120 | } |
Kojto | 122:f9eeca106725 | 1121 | |
Kojto | 122:f9eeca106725 | 1122 | /** |
Kojto | 122:f9eeca106725 | 1123 | * @brief Informs the application whether the counter direction has changed from down to up (when the LPTIM instance operates in encoder mode). |
Kojto | 122:f9eeca106725 | 1124 | * @rmtoll ISR UP LL_LPTIM_IsActiveFlag_UP |
Kojto | 122:f9eeca106725 | 1125 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1126 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1127 | */ |
Kojto | 122:f9eeca106725 | 1128 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_UP(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1129 | { |
Kojto | 122:f9eeca106725 | 1130 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_UP) == (LPTIM_ISR_UP)); |
Kojto | 122:f9eeca106725 | 1131 | } |
Kojto | 122:f9eeca106725 | 1132 | |
Kojto | 122:f9eeca106725 | 1133 | /** |
Kojto | 122:f9eeca106725 | 1134 | * @brief Clear the counter direction change to down interrupt flag (DOWNCF). |
Kojto | 122:f9eeca106725 | 1135 | * @rmtoll ICR DOWNCF LL_LPTIM_ClearFlag_DOWN |
Kojto | 122:f9eeca106725 | 1136 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1137 | * @retval None |
Kojto | 122:f9eeca106725 | 1138 | */ |
Kojto | 122:f9eeca106725 | 1139 | __STATIC_INLINE void LL_LPTIM_ClearFlag_DOWN(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1140 | { |
Kojto | 122:f9eeca106725 | 1141 | SET_BIT(LPTIMx->ICR, LPTIM_ICR_DOWNCF); |
Kojto | 122:f9eeca106725 | 1142 | } |
Kojto | 122:f9eeca106725 | 1143 | |
Kojto | 122:f9eeca106725 | 1144 | /** |
Kojto | 122:f9eeca106725 | 1145 | * @brief Informs the application whether the counter direction has changed from up to down (when the LPTIM instance operates in encoder mode). |
Kojto | 122:f9eeca106725 | 1146 | * @rmtoll ISR DOWN LL_LPTIM_IsActiveFlag_DOWN |
Kojto | 122:f9eeca106725 | 1147 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1148 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1149 | */ |
Kojto | 122:f9eeca106725 | 1150 | __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_DOWN(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1151 | { |
Kojto | 122:f9eeca106725 | 1152 | return (READ_BIT(LPTIMx->ISR, LPTIM_ISR_DOWN) == (LPTIM_ISR_DOWN)); |
Kojto | 122:f9eeca106725 | 1153 | } |
Kojto | 122:f9eeca106725 | 1154 | |
Kojto | 122:f9eeca106725 | 1155 | /** |
Kojto | 122:f9eeca106725 | 1156 | * @} |
Kojto | 122:f9eeca106725 | 1157 | */ |
Kojto | 122:f9eeca106725 | 1158 | |
Kojto | 122:f9eeca106725 | 1159 | /** @defgroup LPTIM_LL_EF_IT_Management Interrupt Management |
Kojto | 122:f9eeca106725 | 1160 | * @{ |
Kojto | 122:f9eeca106725 | 1161 | */ |
Kojto | 122:f9eeca106725 | 1162 | |
Kojto | 122:f9eeca106725 | 1163 | /** |
Kojto | 122:f9eeca106725 | 1164 | * @brief Enable compare match interrupt (CMPMIE). |
Kojto | 122:f9eeca106725 | 1165 | * @rmtoll IER CMPMIE LL_LPTIM_EnableIT_CMPM |
Kojto | 122:f9eeca106725 | 1166 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1167 | * @retval None |
Kojto | 122:f9eeca106725 | 1168 | */ |
Kojto | 122:f9eeca106725 | 1169 | __STATIC_INLINE void LL_LPTIM_EnableIT_CMPM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1170 | { |
Kojto | 122:f9eeca106725 | 1171 | SET_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE); |
Kojto | 122:f9eeca106725 | 1172 | } |
Kojto | 122:f9eeca106725 | 1173 | |
Kojto | 122:f9eeca106725 | 1174 | /** |
Kojto | 122:f9eeca106725 | 1175 | * @brief Disable compare match interrupt (CMPMIE). |
Kojto | 122:f9eeca106725 | 1176 | * @rmtoll IER CMPMIE LL_LPTIM_DisableIT_CMPM |
Kojto | 122:f9eeca106725 | 1177 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1178 | * @retval None |
Kojto | 122:f9eeca106725 | 1179 | */ |
Kojto | 122:f9eeca106725 | 1180 | __STATIC_INLINE void LL_LPTIM_DisableIT_CMPM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1181 | { |
Kojto | 122:f9eeca106725 | 1182 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE); |
Kojto | 122:f9eeca106725 | 1183 | } |
Kojto | 122:f9eeca106725 | 1184 | |
Kojto | 122:f9eeca106725 | 1185 | /** |
Kojto | 122:f9eeca106725 | 1186 | * @brief Indicates whether the compare match interrupt (CMPMIE) is enabled. |
Kojto | 122:f9eeca106725 | 1187 | * @rmtoll IER CMPMIE LL_LPTIM_IsEnabledIT_CMPM |
Kojto | 122:f9eeca106725 | 1188 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1189 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1190 | */ |
Kojto | 122:f9eeca106725 | 1191 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1192 | { |
Kojto | 122:f9eeca106725 | 1193 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE) == (LPTIM_IER_CMPMIE)); |
Kojto | 122:f9eeca106725 | 1194 | } |
Kojto | 122:f9eeca106725 | 1195 | |
Kojto | 122:f9eeca106725 | 1196 | /** |
Kojto | 122:f9eeca106725 | 1197 | * @brief Enable autoreload match interrupt (ARRMIE). |
Kojto | 122:f9eeca106725 | 1198 | * @rmtoll IER ARRMIE LL_LPTIM_EnableIT_ARRM |
Kojto | 122:f9eeca106725 | 1199 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1200 | * @retval None |
Kojto | 122:f9eeca106725 | 1201 | */ |
Kojto | 122:f9eeca106725 | 1202 | __STATIC_INLINE void LL_LPTIM_EnableIT_ARRM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1203 | { |
Kojto | 122:f9eeca106725 | 1204 | SET_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE); |
Kojto | 122:f9eeca106725 | 1205 | } |
Kojto | 122:f9eeca106725 | 1206 | |
Kojto | 122:f9eeca106725 | 1207 | /** |
Kojto | 122:f9eeca106725 | 1208 | * @brief Disable autoreload match interrupt (ARRMIE). |
Kojto | 122:f9eeca106725 | 1209 | * @rmtoll IER ARRMIE LL_LPTIM_DisableIT_ARRM |
Kojto | 122:f9eeca106725 | 1210 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1211 | * @retval None |
Kojto | 122:f9eeca106725 | 1212 | */ |
Kojto | 122:f9eeca106725 | 1213 | __STATIC_INLINE void LL_LPTIM_DisableIT_ARRM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1214 | { |
Kojto | 122:f9eeca106725 | 1215 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE); |
Kojto | 122:f9eeca106725 | 1216 | } |
Kojto | 122:f9eeca106725 | 1217 | |
Kojto | 122:f9eeca106725 | 1218 | /** |
Kojto | 122:f9eeca106725 | 1219 | * @brief Indicates whether the autoreload match interrupt (ARRMIE) is enabled. |
Kojto | 122:f9eeca106725 | 1220 | * @rmtoll IER ARRMIE LL_LPTIM_IsEnabledIT_ARRM |
Kojto | 122:f9eeca106725 | 1221 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1222 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1223 | */ |
Kojto | 122:f9eeca106725 | 1224 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARRM(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1225 | { |
Kojto | 122:f9eeca106725 | 1226 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE) == (LPTIM_IER_ARRMIE)); |
Kojto | 122:f9eeca106725 | 1227 | } |
Kojto | 122:f9eeca106725 | 1228 | |
Kojto | 122:f9eeca106725 | 1229 | /** |
Kojto | 122:f9eeca106725 | 1230 | * @brief Enable external trigger valid edge interrupt (EXTTRIGIE). |
Kojto | 122:f9eeca106725 | 1231 | * @rmtoll IER EXTTRIGIE LL_LPTIM_EnableIT_EXTTRIG |
Kojto | 122:f9eeca106725 | 1232 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1233 | * @retval None |
Kojto | 122:f9eeca106725 | 1234 | */ |
Kojto | 122:f9eeca106725 | 1235 | __STATIC_INLINE void LL_LPTIM_EnableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1236 | { |
Kojto | 122:f9eeca106725 | 1237 | SET_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE); |
Kojto | 122:f9eeca106725 | 1238 | } |
Kojto | 122:f9eeca106725 | 1239 | |
Kojto | 122:f9eeca106725 | 1240 | /** |
Kojto | 122:f9eeca106725 | 1241 | * @brief Disable external trigger valid edge interrupt (EXTTRIGIE). |
Kojto | 122:f9eeca106725 | 1242 | * @rmtoll IER EXTTRIGIE LL_LPTIM_DisableIT_EXTTRIG |
Kojto | 122:f9eeca106725 | 1243 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1244 | * @retval None |
Kojto | 122:f9eeca106725 | 1245 | */ |
Kojto | 122:f9eeca106725 | 1246 | __STATIC_INLINE void LL_LPTIM_DisableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1247 | { |
Kojto | 122:f9eeca106725 | 1248 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE); |
Kojto | 122:f9eeca106725 | 1249 | } |
Kojto | 122:f9eeca106725 | 1250 | |
Kojto | 122:f9eeca106725 | 1251 | /** |
Kojto | 122:f9eeca106725 | 1252 | * @brief Indicates external trigger valid edge interrupt (EXTTRIGIE) is enabled. |
Kojto | 122:f9eeca106725 | 1253 | * @rmtoll IER EXTTRIGIE LL_LPTIM_IsEnabledIT_EXTTRIG |
Kojto | 122:f9eeca106725 | 1254 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1255 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1256 | */ |
Kojto | 122:f9eeca106725 | 1257 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1258 | { |
Kojto | 122:f9eeca106725 | 1259 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE) == (LPTIM_IER_EXTTRIGIE)); |
Kojto | 122:f9eeca106725 | 1260 | } |
Kojto | 122:f9eeca106725 | 1261 | |
Kojto | 122:f9eeca106725 | 1262 | /** |
Kojto | 122:f9eeca106725 | 1263 | * @brief Enable compare register write completed interrupt (CMPOKIE). |
Kojto | 122:f9eeca106725 | 1264 | * @rmtoll IER CMPOKIE LL_LPTIM_EnableIT_CMPOK |
Kojto | 122:f9eeca106725 | 1265 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1266 | * @retval None |
Kojto | 122:f9eeca106725 | 1267 | */ |
Kojto | 122:f9eeca106725 | 1268 | __STATIC_INLINE void LL_LPTIM_EnableIT_CMPOK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1269 | { |
Kojto | 122:f9eeca106725 | 1270 | SET_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE); |
Kojto | 122:f9eeca106725 | 1271 | } |
Kojto | 122:f9eeca106725 | 1272 | |
Kojto | 122:f9eeca106725 | 1273 | /** |
Kojto | 122:f9eeca106725 | 1274 | * @brief Disable compare register write completed interrupt (CMPOKIE). |
Kojto | 122:f9eeca106725 | 1275 | * @rmtoll IER CMPOKIE LL_LPTIM_DisableIT_CMPOK |
Kojto | 122:f9eeca106725 | 1276 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1277 | * @retval None |
Kojto | 122:f9eeca106725 | 1278 | */ |
Kojto | 122:f9eeca106725 | 1279 | __STATIC_INLINE void LL_LPTIM_DisableIT_CMPOK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1280 | { |
Kojto | 122:f9eeca106725 | 1281 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE); |
Kojto | 122:f9eeca106725 | 1282 | } |
Kojto | 122:f9eeca106725 | 1283 | |
Kojto | 122:f9eeca106725 | 1284 | /** |
Kojto | 122:f9eeca106725 | 1285 | * @brief Indicates whether the compare register write completed interrupt (CMPOKIE) is enabled. |
Kojto | 122:f9eeca106725 | 1286 | * @rmtoll IER CMPOKIE LL_LPTIM_IsEnabledIT_CMPOK |
Kojto | 122:f9eeca106725 | 1287 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1288 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1289 | */ |
Kojto | 122:f9eeca106725 | 1290 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPOK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1291 | { |
Kojto | 122:f9eeca106725 | 1292 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE) == (LPTIM_IER_CMPOKIE)); |
Kojto | 122:f9eeca106725 | 1293 | } |
Kojto | 122:f9eeca106725 | 1294 | |
Kojto | 122:f9eeca106725 | 1295 | /** |
Kojto | 122:f9eeca106725 | 1296 | * @brief Enable autoreload register write completed interrupt (ARROKIE). |
Kojto | 122:f9eeca106725 | 1297 | * @rmtoll IER ARROKIE LL_LPTIM_EnableIT_ARROK |
Kojto | 122:f9eeca106725 | 1298 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1299 | * @retval None |
Kojto | 122:f9eeca106725 | 1300 | */ |
Kojto | 122:f9eeca106725 | 1301 | __STATIC_INLINE void LL_LPTIM_EnableIT_ARROK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1302 | { |
Kojto | 122:f9eeca106725 | 1303 | SET_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE); |
Kojto | 122:f9eeca106725 | 1304 | } |
Kojto | 122:f9eeca106725 | 1305 | |
Kojto | 122:f9eeca106725 | 1306 | /** |
Kojto | 122:f9eeca106725 | 1307 | * @brief Disable autoreload register write completed interrupt (ARROKIE). |
Kojto | 122:f9eeca106725 | 1308 | * @rmtoll IER ARROKIE LL_LPTIM_DisableIT_ARROK |
Kojto | 122:f9eeca106725 | 1309 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1310 | * @retval None |
Kojto | 122:f9eeca106725 | 1311 | */ |
Kojto | 122:f9eeca106725 | 1312 | __STATIC_INLINE void LL_LPTIM_DisableIT_ARROK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1313 | { |
Kojto | 122:f9eeca106725 | 1314 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE); |
Kojto | 122:f9eeca106725 | 1315 | } |
Kojto | 122:f9eeca106725 | 1316 | |
Kojto | 122:f9eeca106725 | 1317 | /** |
Kojto | 122:f9eeca106725 | 1318 | * @brief Indicates whether the autoreload register write completed interrupt (ARROKIE) is enabled. |
Kojto | 122:f9eeca106725 | 1319 | * @rmtoll IER ARROKIE LL_LPTIM_IsEnabledIT_ARROK |
Kojto | 122:f9eeca106725 | 1320 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1321 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1322 | */ |
Kojto | 122:f9eeca106725 | 1323 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARROK(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1324 | { |
Kojto | 122:f9eeca106725 | 1325 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE) == (LPTIM_IER_ARROKIE)); |
Kojto | 122:f9eeca106725 | 1326 | } |
Kojto | 122:f9eeca106725 | 1327 | |
Kojto | 122:f9eeca106725 | 1328 | /** |
Kojto | 122:f9eeca106725 | 1329 | * @brief Enable direction change to up interrupt (UPIE). |
Kojto | 122:f9eeca106725 | 1330 | * @rmtoll IER UPIE LL_LPTIM_EnableIT_UP |
Kojto | 122:f9eeca106725 | 1331 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1332 | * @retval None |
Kojto | 122:f9eeca106725 | 1333 | */ |
Kojto | 122:f9eeca106725 | 1334 | __STATIC_INLINE void LL_LPTIM_EnableIT_UP(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1335 | { |
Kojto | 122:f9eeca106725 | 1336 | SET_BIT(LPTIMx->IER, LPTIM_IER_UPIE); |
Kojto | 122:f9eeca106725 | 1337 | } |
Kojto | 122:f9eeca106725 | 1338 | |
Kojto | 122:f9eeca106725 | 1339 | /** |
Kojto | 122:f9eeca106725 | 1340 | * @brief Disable direction change to up interrupt (UPIE). |
Kojto | 122:f9eeca106725 | 1341 | * @rmtoll IER UPIE LL_LPTIM_DisableIT_UP |
Kojto | 122:f9eeca106725 | 1342 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1343 | * @retval None |
Kojto | 122:f9eeca106725 | 1344 | */ |
Kojto | 122:f9eeca106725 | 1345 | __STATIC_INLINE void LL_LPTIM_DisableIT_UP(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1346 | { |
Kojto | 122:f9eeca106725 | 1347 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_UPIE); |
Kojto | 122:f9eeca106725 | 1348 | } |
Kojto | 122:f9eeca106725 | 1349 | |
Kojto | 122:f9eeca106725 | 1350 | /** |
Kojto | 122:f9eeca106725 | 1351 | * @brief Indicates whether the direction change to up interrupt (UPIE) is enabled. |
Kojto | 122:f9eeca106725 | 1352 | * @rmtoll IER UPIE LL_LPTIM_IsEnabledIT_UP |
Kojto | 122:f9eeca106725 | 1353 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1354 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1355 | */ |
Kojto | 122:f9eeca106725 | 1356 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_UP(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1357 | { |
Kojto | 122:f9eeca106725 | 1358 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_UPIE) == (LPTIM_IER_UPIE)); |
Kojto | 122:f9eeca106725 | 1359 | } |
Kojto | 122:f9eeca106725 | 1360 | |
Kojto | 122:f9eeca106725 | 1361 | /** |
Kojto | 122:f9eeca106725 | 1362 | * @brief Enable direction change to down interrupt (DOWNIE). |
Kojto | 122:f9eeca106725 | 1363 | * @rmtoll IER DOWNIE LL_LPTIM_EnableIT_DOWN |
Kojto | 122:f9eeca106725 | 1364 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1365 | * @retval None |
Kojto | 122:f9eeca106725 | 1366 | */ |
Kojto | 122:f9eeca106725 | 1367 | __STATIC_INLINE void LL_LPTIM_EnableIT_DOWN(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1368 | { |
Kojto | 122:f9eeca106725 | 1369 | SET_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE); |
Kojto | 122:f9eeca106725 | 1370 | } |
Kojto | 122:f9eeca106725 | 1371 | |
Kojto | 122:f9eeca106725 | 1372 | /** |
Kojto | 122:f9eeca106725 | 1373 | * @brief Disable direction change to down interrupt (DOWNIE). |
Kojto | 122:f9eeca106725 | 1374 | * @rmtoll IER DOWNIE LL_LPTIM_DisableIT_DOWN |
Kojto | 122:f9eeca106725 | 1375 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1376 | * @retval None |
Kojto | 122:f9eeca106725 | 1377 | */ |
Kojto | 122:f9eeca106725 | 1378 | __STATIC_INLINE void LL_LPTIM_DisableIT_DOWN(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1379 | { |
Kojto | 122:f9eeca106725 | 1380 | CLEAR_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE); |
Kojto | 122:f9eeca106725 | 1381 | } |
Kojto | 122:f9eeca106725 | 1382 | |
Kojto | 122:f9eeca106725 | 1383 | /** |
Kojto | 122:f9eeca106725 | 1384 | * @brief Indicates whether the direction change to down interrupt (DOWNIE) is enabled. |
Kojto | 122:f9eeca106725 | 1385 | * @rmtoll IER DOWNIE LL_LPTIM_IsEnabledIT_DOWN |
Kojto | 122:f9eeca106725 | 1386 | * @param LPTIMx Low-Power Timer instance |
Kojto | 122:f9eeca106725 | 1387 | * @retval State of bit (1 or 0). |
Kojto | 122:f9eeca106725 | 1388 | */ |
Kojto | 122:f9eeca106725 | 1389 | __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_DOWN(LPTIM_TypeDef *LPTIMx) |
Kojto | 122:f9eeca106725 | 1390 | { |
Kojto | 122:f9eeca106725 | 1391 | return (READ_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE) == (LPTIM_IER_DOWNIE)); |
Kojto | 122:f9eeca106725 | 1392 | } |
Kojto | 122:f9eeca106725 | 1393 | |
Kojto | 122:f9eeca106725 | 1394 | /** |
Kojto | 122:f9eeca106725 | 1395 | * @} |
Kojto | 122:f9eeca106725 | 1396 | */ |
Kojto | 122:f9eeca106725 | 1397 | |
Kojto | 122:f9eeca106725 | 1398 | #if defined(USE_FULL_LL_DRIVER) |
Kojto | 122:f9eeca106725 | 1399 | /** @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions |
Kojto | 122:f9eeca106725 | 1400 | * @{ |
Kojto | 122:f9eeca106725 | 1401 | */ |
Kojto | 122:f9eeca106725 | 1402 | |
Kojto | 122:f9eeca106725 | 1403 | ErrorStatus LL_LPTIM_DeInit(LPTIM_TypeDef *LPTIMx); |
Kojto | 122:f9eeca106725 | 1404 | void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct); |
Kojto | 122:f9eeca106725 | 1405 | ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, LL_LPTIM_InitTypeDef *LPTIM_InitStruct); |
Kojto | 122:f9eeca106725 | 1406 | /** |
Kojto | 122:f9eeca106725 | 1407 | * @} |
Kojto | 122:f9eeca106725 | 1408 | */ |
Kojto | 122:f9eeca106725 | 1409 | #endif /* USE_FULL_LL_DRIVER */ |
Kojto | 122:f9eeca106725 | 1410 | |
Kojto | 122:f9eeca106725 | 1411 | /** |
Kojto | 122:f9eeca106725 | 1412 | * @} |
Kojto | 122:f9eeca106725 | 1413 | */ |
Kojto | 122:f9eeca106725 | 1414 | |
Kojto | 122:f9eeca106725 | 1415 | /** |
Kojto | 122:f9eeca106725 | 1416 | * @} |
Kojto | 122:f9eeca106725 | 1417 | */ |
Kojto | 122:f9eeca106725 | 1418 | |
Kojto | 122:f9eeca106725 | 1419 | #endif /* LPTIM1 || LPTIM2 */ |
Kojto | 122:f9eeca106725 | 1420 | |
Kojto | 122:f9eeca106725 | 1421 | /** |
Kojto | 122:f9eeca106725 | 1422 | * @} |
Kojto | 122:f9eeca106725 | 1423 | */ |
Kojto | 122:f9eeca106725 | 1424 | |
Kojto | 122:f9eeca106725 | 1425 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 1426 | } |
Kojto | 122:f9eeca106725 | 1427 | #endif |
Kojto | 122:f9eeca106725 | 1428 | |
Kojto | 122:f9eeca106725 | 1429 | #endif /* __STM32L4xx_LL_LPTIM_H */ |
Kojto | 122:f9eeca106725 | 1430 | |
Kojto | 122:f9eeca106725 | 1431 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |