Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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