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