mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 158:b23ee177fd68 1 /**
Kojto 158:b23ee177fd68 2 ******************************************************************************
Kojto 158:b23ee177fd68 3 * @file stm32l0xx_ll_tim.h
Kojto 158:b23ee177fd68 4 * @author MCD Application Team
Kojto 158:b23ee177fd68 5 * @brief Header file of TIM LL module.
Kojto 158:b23ee177fd68 6 ******************************************************************************
Kojto 158:b23ee177fd68 7 * @attention
Kojto 158:b23ee177fd68 8 *
Kojto 158:b23ee177fd68 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 158:b23ee177fd68 10 *
Kojto 158:b23ee177fd68 11 * Redistribution and use in source and binary forms, with or without modification,
Kojto 158:b23ee177fd68 12 * are permitted provided that the following conditions are met:
Kojto 158:b23ee177fd68 13 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 158:b23ee177fd68 14 * this list of conditions and the following disclaimer.
Kojto 158:b23ee177fd68 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 158:b23ee177fd68 16 * this list of conditions and the following disclaimer in the documentation
Kojto 158:b23ee177fd68 17 * and/or other materials provided with the distribution.
Kojto 158:b23ee177fd68 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 158:b23ee177fd68 19 * may be used to endorse or promote products derived from this software
Kojto 158:b23ee177fd68 20 * without specific prior written permission.
Kojto 158:b23ee177fd68 21 *
Kojto 158:b23ee177fd68 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 158:b23ee177fd68 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 158:b23ee177fd68 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 158:b23ee177fd68 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 158:b23ee177fd68 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 158:b23ee177fd68 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 158:b23ee177fd68 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 158:b23ee177fd68 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 158:b23ee177fd68 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 158:b23ee177fd68 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 158:b23ee177fd68 32 *
Kojto 158:b23ee177fd68 33 ******************************************************************************
Kojto 158:b23ee177fd68 34 */
Kojto 158:b23ee177fd68 35
Kojto 158:b23ee177fd68 36 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 158:b23ee177fd68 37 #ifndef __STM32L0xx_LL_TIM_H
Kojto 158:b23ee177fd68 38 #define __STM32L0xx_LL_TIM_H
Kojto 158:b23ee177fd68 39
Kojto 158:b23ee177fd68 40 #ifdef __cplusplus
Kojto 158:b23ee177fd68 41 extern "C" {
Kojto 158:b23ee177fd68 42 #endif
Kojto 158:b23ee177fd68 43
Kojto 158:b23ee177fd68 44 /* Includes ------------------------------------------------------------------*/
Kojto 158:b23ee177fd68 45 #include "stm32l0xx.h"
Kojto 158:b23ee177fd68 46
Kojto 158:b23ee177fd68 47 /** @addtogroup STM32L0xx_LL_Driver
Kojto 158:b23ee177fd68 48 * @{
Kojto 158:b23ee177fd68 49 */
Kojto 158:b23ee177fd68 50
Kojto 158:b23ee177fd68 51 #if defined (TIM2) || defined (TIM3) || defined (TIM21) || defined (TIM22) || defined (TIM6) || defined (TIM7)
Kojto 158:b23ee177fd68 52
Kojto 158:b23ee177fd68 53 /** @defgroup TIM_LL TIM
Kojto 158:b23ee177fd68 54 * @{
Kojto 158:b23ee177fd68 55 */
Kojto 158:b23ee177fd68 56
Kojto 158:b23ee177fd68 57 /* Private types -------------------------------------------------------------*/
Kojto 158:b23ee177fd68 58 /* Private variables ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 59 /** @defgroup TIM_LL_Private_Variables TIM Private Variables
Kojto 158:b23ee177fd68 60 * @{
Kojto 158:b23ee177fd68 61 */
Anna Bridge 186:707f6e361f3e 62 static const uint8_t OFFSET_TAB_CCMRx[] =
Anna Bridge 186:707f6e361f3e 63 {
Anna Bridge 186:707f6e361f3e 64 0x00U, /* 0: TIMx_CH1 */
Anna Bridge 186:707f6e361f3e 65 0x00U, /* 1: NA */
Anna Bridge 186:707f6e361f3e 66 0x00U, /* 2: TIMx_CH2 */
Anna Bridge 186:707f6e361f3e 67 0x00U, /* 3: NA */
Anna Bridge 186:707f6e361f3e 68 0x04U, /* 4: TIMx_CH3 */
Anna Bridge 186:707f6e361f3e 69 0x00U, /* 5: NA */
Anna Bridge 186:707f6e361f3e 70 0x04U /* 6: TIMx_CH4 */
Anna Bridge 186:707f6e361f3e 71 };
Kojto 158:b23ee177fd68 72
Kojto 158:b23ee177fd68 73 static const uint8_t SHIFT_TAB_OCxx[] =
Kojto 158:b23ee177fd68 74 {
Kojto 158:b23ee177fd68 75 0U, /* 0: OC1M, OC1FE, OC1PE */
Kojto 158:b23ee177fd68 76 0U, /* 1: - NA */
Kojto 158:b23ee177fd68 77 8U, /* 2: OC2M, OC2FE, OC2PE */
Kojto 158:b23ee177fd68 78 0U, /* 3: - NA */
Kojto 158:b23ee177fd68 79 0U, /* 4: OC3M, OC3FE, OC3PE */
Kojto 158:b23ee177fd68 80 0U, /* 5: - NA */
Kojto 158:b23ee177fd68 81 8U /* 6: OC4M, OC4FE, OC4PE */
Kojto 158:b23ee177fd68 82 };
Kojto 158:b23ee177fd68 83
Kojto 158:b23ee177fd68 84 static const uint8_t SHIFT_TAB_ICxx[] =
Kojto 158:b23ee177fd68 85 {
Kojto 158:b23ee177fd68 86 0U, /* 0: CC1S, IC1PSC, IC1F */
Kojto 158:b23ee177fd68 87 0U, /* 1: - NA */
Kojto 158:b23ee177fd68 88 8U, /* 2: CC2S, IC2PSC, IC2F */
Kojto 158:b23ee177fd68 89 0U, /* 3: - NA */
Kojto 158:b23ee177fd68 90 0U, /* 4: CC3S, IC3PSC, IC3F */
Kojto 158:b23ee177fd68 91 0U, /* 5: - NA */
Kojto 158:b23ee177fd68 92 8U /* 6: CC4S, IC4PSC, IC4F */
Kojto 158:b23ee177fd68 93 };
Kojto 158:b23ee177fd68 94
Kojto 158:b23ee177fd68 95 static const uint8_t SHIFT_TAB_CCxP[] =
Kojto 158:b23ee177fd68 96 {
Kojto 158:b23ee177fd68 97 0U, /* 0: CC1P */
Kojto 158:b23ee177fd68 98 0U, /* 1: NA */
Kojto 158:b23ee177fd68 99 4U, /* 2: CC2P */
Kojto 158:b23ee177fd68 100 0U, /* 3: NA */
Kojto 158:b23ee177fd68 101 8U, /* 4: CC3P */
Kojto 158:b23ee177fd68 102 0U, /* 5: NA */
Kojto 158:b23ee177fd68 103 12U /* 6: CC4P */
Kojto 158:b23ee177fd68 104 };
Kojto 158:b23ee177fd68 105
Kojto 158:b23ee177fd68 106 /**
Kojto 158:b23ee177fd68 107 * @}
Kojto 158:b23ee177fd68 108 */
Kojto 158:b23ee177fd68 109
Kojto 158:b23ee177fd68 110
Kojto 158:b23ee177fd68 111 /* Private constants ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 112 /** @defgroup TIM_LL_Private_Constants TIM Private Constants
Kojto 158:b23ee177fd68 113 * @{
Kojto 158:b23ee177fd68 114 */
Kojto 158:b23ee177fd68 115
Kojto 158:b23ee177fd68 116
Kojto 158:b23ee177fd68 117 /* Remap mask definitions */
Kojto 158:b23ee177fd68 118 #define TIMx_OR_RMP_SHIFT ((uint32_t)16U)
Kojto 158:b23ee177fd68 119 #define TIMx_OR_RMP_MASK ((uint32_t)0x0000FFFFU)
Kojto 158:b23ee177fd68 120 #define TIM2_OR_RMP_MASK ((uint32_t)((TIM2_OR_ETR_RMP | TIM2_OR_TI4_RMP ) << TIMx_OR_RMP_SHIFT))
Kojto 158:b23ee177fd68 121 #define TIM21_OR_RMP_MASK ((uint32_t)((TIM21_OR_ETR_RMP | TIM21_OR_TI1_RMP | TIM21_OR_TI2_RMP) << TIMx_OR_RMP_SHIFT))
Kojto 158:b23ee177fd68 122 #define TIM22_OR_RMP_MASK ((uint32_t)((TIM22_OR_ETR_RMP | TIM22_OR_TI1_RMP) << TIMx_OR_RMP_SHIFT))
Kojto 158:b23ee177fd68 123 #if defined(TIM3)
Kojto 158:b23ee177fd68 124 #define TIM3_OR_RMP_MASK ((uint32_t)((TIM3_OR_ETR_RMP | TIM3_OR_TI1_RMP | TIM3_OR_TI2_RMP | TIM3_OR_TI4_RMP) << TIMx_OR_RMP_SHIFT))
Kojto 158:b23ee177fd68 125 #endif /* TIM3 */
Kojto 158:b23ee177fd68 126
Kojto 158:b23ee177fd68 127
Kojto 158:b23ee177fd68 128
Kojto 158:b23ee177fd68 129 /**
Kojto 158:b23ee177fd68 130 * @}
Kojto 158:b23ee177fd68 131 */
Kojto 158:b23ee177fd68 132
Kojto 158:b23ee177fd68 133
Kojto 158:b23ee177fd68 134 /* Private macros ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 135 /** @defgroup TIM_LL_Private_Macros TIM Private Macros
Kojto 158:b23ee177fd68 136 * @{
Kojto 158:b23ee177fd68 137 */
Kojto 158:b23ee177fd68 138 /** @brief Convert channel id into channel index.
Anna Bridge 186:707f6e361f3e 139 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 158:b23ee177fd68 140 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 141 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 142 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 143 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 144 * @retval none
Kojto 158:b23ee177fd68 145 */
Kojto 158:b23ee177fd68 146 #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \
Kojto 158:b23ee177fd68 147 (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\
Kojto 158:b23ee177fd68 148 ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\
Kojto 158:b23ee177fd68 149 ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U : 6U)
Kojto 158:b23ee177fd68 150
Kojto 158:b23ee177fd68 151 /**
Kojto 158:b23ee177fd68 152 * @}
Kojto 158:b23ee177fd68 153 */
Kojto 158:b23ee177fd68 154
Kojto 158:b23ee177fd68 155
Kojto 158:b23ee177fd68 156 /* Exported types ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 157 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 158 /** @defgroup TIM_LL_ES_INIT TIM Exported Init structure
Kojto 158:b23ee177fd68 159 * @{
Kojto 158:b23ee177fd68 160 */
Kojto 158:b23ee177fd68 161
Anna Bridge 186:707f6e361f3e 162 /**
Anna Bridge 186:707f6e361f3e 163 * @brief TIM Time Base configuration structure definition.
Kojto 158:b23ee177fd68 164 */
Kojto 158:b23ee177fd68 165 typedef struct
Kojto 158:b23ee177fd68 166 {
Kojto 158:b23ee177fd68 167 uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
Anna Bridge 186:707f6e361f3e 168 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
Kojto 158:b23ee177fd68 169
Kojto 158:b23ee177fd68 170 This feature can be modified afterwards using unitary function @ref LL_TIM_SetPrescaler().*/
Kojto 158:b23ee177fd68 171
Kojto 158:b23ee177fd68 172 uint32_t CounterMode; /*!< Specifies the counter mode.
Kojto 158:b23ee177fd68 173 This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE.
Kojto 158:b23ee177fd68 174
Kojto 158:b23ee177fd68 175 This feature can be modified afterwards using unitary function @ref LL_TIM_SetCounterMode().*/
Kojto 158:b23ee177fd68 176
Kojto 158:b23ee177fd68 177 uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active
Kojto 158:b23ee177fd68 178 Auto-Reload Register at the next update event.
Anna Bridge 186:707f6e361f3e 179 This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
Anna Bridge 186:707f6e361f3e 180 Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF.
Anna Bridge 186:707f6e361f3e 181
Anna Bridge 186:707f6e361f3e 182 This feature can be modified afterwards using unitary function @ref LL_TIM_SetAutoReload().*/
Kojto 158:b23ee177fd68 183
Kojto 158:b23ee177fd68 184 uint32_t ClockDivision; /*!< Specifies the clock division.
Anna Bridge 186:707f6e361f3e 185 This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION.
Anna Bridge 186:707f6e361f3e 186
Kojto 158:b23ee177fd68 187 This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/
Anna Bridge 186:707f6e361f3e 188 } LL_TIM_InitTypeDef;
Anna Bridge 186:707f6e361f3e 189
Anna Bridge 186:707f6e361f3e 190 /**
Anna Bridge 186:707f6e361f3e 191 * @brief TIM Output Compare configuration structure definition.
Kojto 158:b23ee177fd68 192 */
Kojto 158:b23ee177fd68 193 typedef struct
Kojto 158:b23ee177fd68 194 {
Kojto 158:b23ee177fd68 195 uint32_t OCMode; /*!< Specifies the output mode.
Kojto 158:b23ee177fd68 196 This parameter can be a value of @ref TIM_LL_EC_OCMODE.
Kojto 158:b23ee177fd68 197
Kojto 158:b23ee177fd68 198 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetMode().*/
Kojto 158:b23ee177fd68 199
Kojto 158:b23ee177fd68 200 uint32_t OCState; /*!< Specifies the TIM Output Compare state.
Kojto 158:b23ee177fd68 201 This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
Kojto 158:b23ee177fd68 202
Kojto 158:b23ee177fd68 203 This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
Kojto 158:b23ee177fd68 204
Kojto 158:b23ee177fd68 205 uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register.
Anna Bridge 186:707f6e361f3e 206 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
Kojto 158:b23ee177fd68 207
Kojto 158:b23ee177fd68 208 This feature can be modified afterwards using unitary function LL_TIM_OC_SetCompareCHx (x=1..6).*/
Kojto 158:b23ee177fd68 209
Kojto 158:b23ee177fd68 210 uint32_t OCPolarity; /*!< Specifies the output polarity.
Kojto 158:b23ee177fd68 211 This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
Kojto 158:b23ee177fd68 212
Kojto 158:b23ee177fd68 213 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/
Kojto 158:b23ee177fd68 214
Kojto 158:b23ee177fd68 215 } LL_TIM_OC_InitTypeDef;
Kojto 158:b23ee177fd68 216
Anna Bridge 186:707f6e361f3e 217 /**
Anna Bridge 186:707f6e361f3e 218 * @brief TIM Input Capture configuration structure definition.
Kojto 158:b23ee177fd68 219 */
Kojto 158:b23ee177fd68 220
Kojto 158:b23ee177fd68 221 typedef struct
Kojto 158:b23ee177fd68 222 {
Kojto 158:b23ee177fd68 223
Kojto 158:b23ee177fd68 224 uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
Kojto 158:b23ee177fd68 225 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
Kojto 158:b23ee177fd68 226
Kojto 158:b23ee177fd68 227 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
Kojto 158:b23ee177fd68 228
Kojto 158:b23ee177fd68 229 uint32_t ICActiveInput; /*!< Specifies the input.
Kojto 158:b23ee177fd68 230 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
Kojto 158:b23ee177fd68 231
Kojto 158:b23ee177fd68 232 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
Kojto 158:b23ee177fd68 233
Kojto 158:b23ee177fd68 234 uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler.
Kojto 158:b23ee177fd68 235 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
Kojto 158:b23ee177fd68 236
Kojto 158:b23ee177fd68 237 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
Kojto 158:b23ee177fd68 238
Kojto 158:b23ee177fd68 239 uint32_t ICFilter; /*!< Specifies the input capture filter.
Kojto 158:b23ee177fd68 240 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
Kojto 158:b23ee177fd68 241
Kojto 158:b23ee177fd68 242 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
Kojto 158:b23ee177fd68 243 } LL_TIM_IC_InitTypeDef;
Kojto 158:b23ee177fd68 244
Kojto 158:b23ee177fd68 245
Kojto 158:b23ee177fd68 246 /**
Kojto 158:b23ee177fd68 247 * @brief TIM Encoder interface configuration structure definition.
Kojto 158:b23ee177fd68 248 */
Kojto 158:b23ee177fd68 249 typedef struct
Kojto 158:b23ee177fd68 250 {
Kojto 158:b23ee177fd68 251 uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4).
Kojto 158:b23ee177fd68 252 This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE.
Kojto 158:b23ee177fd68 253
Kojto 158:b23ee177fd68 254 This feature can be modified afterwards using unitary function @ref LL_TIM_SetEncoderMode().*/
Kojto 158:b23ee177fd68 255
Kojto 158:b23ee177fd68 256 uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
Kojto 158:b23ee177fd68 257 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
Kojto 158:b23ee177fd68 258
Kojto 158:b23ee177fd68 259 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
Kojto 158:b23ee177fd68 260
Kojto 158:b23ee177fd68 261 uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source
Kojto 158:b23ee177fd68 262 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
Kojto 158:b23ee177fd68 263
Kojto 158:b23ee177fd68 264 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
Kojto 158:b23ee177fd68 265
Kojto 158:b23ee177fd68 266 uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
Kojto 158:b23ee177fd68 267 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
Kojto 158:b23ee177fd68 268
Kojto 158:b23ee177fd68 269 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
Kojto 158:b23ee177fd68 270
Kojto 158:b23ee177fd68 271 uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
Kojto 158:b23ee177fd68 272 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
Kojto 158:b23ee177fd68 273
Kojto 158:b23ee177fd68 274 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
Kojto 158:b23ee177fd68 275
Kojto 158:b23ee177fd68 276 uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input.
Kojto 158:b23ee177fd68 277 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
Kojto 158:b23ee177fd68 278
Kojto 158:b23ee177fd68 279 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
Kojto 158:b23ee177fd68 280
Kojto 158:b23ee177fd68 281 uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source
Kojto 158:b23ee177fd68 282 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
Kojto 158:b23ee177fd68 283
Kojto 158:b23ee177fd68 284 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
Kojto 158:b23ee177fd68 285
Kojto 158:b23ee177fd68 286 uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value.
Kojto 158:b23ee177fd68 287 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
Kojto 158:b23ee177fd68 288
Kojto 158:b23ee177fd68 289 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
Kojto 158:b23ee177fd68 290
Kojto 158:b23ee177fd68 291 uint32_t IC2Filter; /*!< Specifies the TI2 input filter.
Kojto 158:b23ee177fd68 292 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
Kojto 158:b23ee177fd68 293
Kojto 158:b23ee177fd68 294 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
Kojto 158:b23ee177fd68 295
Kojto 158:b23ee177fd68 296 } LL_TIM_ENCODER_InitTypeDef;
Kojto 158:b23ee177fd68 297
Kojto 158:b23ee177fd68 298
Kojto 158:b23ee177fd68 299 /**
Kojto 158:b23ee177fd68 300 * @}
Kojto 158:b23ee177fd68 301 */
Kojto 158:b23ee177fd68 302 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 303
Kojto 158:b23ee177fd68 304 /* Exported constants --------------------------------------------------------*/
Kojto 158:b23ee177fd68 305 /** @defgroup TIM_LL_Exported_Constants TIM Exported Constants
Kojto 158:b23ee177fd68 306 * @{
Kojto 158:b23ee177fd68 307 */
Anna Bridge 186:707f6e361f3e 308
Kojto 158:b23ee177fd68 309 /** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines
Kojto 158:b23ee177fd68 310 * @brief Flags defines which can be used with LL_TIM_ReadReg function.
Kojto 158:b23ee177fd68 311 * @{
Kojto 158:b23ee177fd68 312 */
Kojto 158:b23ee177fd68 313 #define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */
Kojto 158:b23ee177fd68 314 #define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */
Kojto 158:b23ee177fd68 315 #define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */
Kojto 158:b23ee177fd68 316 #define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */
Kojto 158:b23ee177fd68 317 #define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */
Kojto 158:b23ee177fd68 318 #define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */
Kojto 158:b23ee177fd68 319 #define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */
Kojto 158:b23ee177fd68 320 #define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */
Kojto 158:b23ee177fd68 321 #define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */
Kojto 158:b23ee177fd68 322 #define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */
Kojto 158:b23ee177fd68 323 /**
Kojto 158:b23ee177fd68 324 * @}
Kojto 158:b23ee177fd68 325 */
Kojto 158:b23ee177fd68 326
Kojto 158:b23ee177fd68 327 /** @defgroup TIM_LL_EC_IT IT Defines
Kojto 158:b23ee177fd68 328 * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions.
Kojto 158:b23ee177fd68 329 * @{
Kojto 158:b23ee177fd68 330 */
Kojto 158:b23ee177fd68 331 #define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */
Kojto 158:b23ee177fd68 332 #define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */
Kojto 158:b23ee177fd68 333 #define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */
Kojto 158:b23ee177fd68 334 #define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */
Kojto 158:b23ee177fd68 335 #define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */
Kojto 158:b23ee177fd68 336 #define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */
Kojto 158:b23ee177fd68 337 /**
Kojto 158:b23ee177fd68 338 * @}
Kojto 158:b23ee177fd68 339 */
Kojto 158:b23ee177fd68 340
Kojto 158:b23ee177fd68 341 /** @defgroup TIM_LL_EC_UPDATESOURCE Update Source
Kojto 158:b23ee177fd68 342 * @{
Kojto 158:b23ee177fd68 343 */
Anna Bridge 186:707f6e361f3e 344 #define LL_TIM_UPDATESOURCE_REGULAR ((uint32_t)0x00000000U) /*!< Counter overflow/underflow, Setting the UG bit or Update generation through the slave mode controller generates an update request */
Anna Bridge 186:707f6e361f3e 345 #define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */
Kojto 158:b23ee177fd68 346 /**
Kojto 158:b23ee177fd68 347 * @}
Kojto 158:b23ee177fd68 348 */
Kojto 158:b23ee177fd68 349
Kojto 158:b23ee177fd68 350 /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode
Kojto 158:b23ee177fd68 351 * @{
Kojto 158:b23ee177fd68 352 */
Anna Bridge 186:707f6e361f3e 353 #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter is not stopped at update event */
Anna Bridge 186:707f6e361f3e 354 #define LL_TIM_ONEPULSEMODE_REPETITIVE ((uint32_t)0x00000000U) /*!< Counter stops counting at the next update event */
Kojto 158:b23ee177fd68 355 /**
Kojto 158:b23ee177fd68 356 * @}
Kojto 158:b23ee177fd68 357 */
Kojto 158:b23ee177fd68 358
Kojto 158:b23ee177fd68 359 /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode
Kojto 158:b23ee177fd68 360 * @{
Kojto 158:b23ee177fd68 361 */
Anna Bridge 186:707f6e361f3e 362 #define LL_TIM_COUNTERMODE_UP ((uint32_t)0x00000000U) /*!<Counter used as upcounter */
Anna Bridge 186:707f6e361f3e 363 #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */
Anna Bridge 186:707f6e361f3e 364 #define LL_TIM_COUNTERMODE_CENTER_UP TIM_CR1_CMS_0 /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting down. */
Anna Bridge 186:707f6e361f3e 365 #define LL_TIM_COUNTERMODE_CENTER_DOWN TIM_CR1_CMS_1 /*!<The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up */
Anna Bridge 186:707f6e361f3e 366 #define LL_TIM_COUNTERMODE_CENTER_UP_DOWN TIM_CR1_CMS /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up or down. */
Kojto 158:b23ee177fd68 367 /**
Kojto 158:b23ee177fd68 368 * @}
Kojto 158:b23ee177fd68 369 */
Kojto 158:b23ee177fd68 370
Kojto 158:b23ee177fd68 371 /** @defgroup TIM_LL_EC_CLOCKDIVISION Clock Division
Kojto 158:b23ee177fd68 372 * @{
Kojto 158:b23ee177fd68 373 */
Anna Bridge 186:707f6e361f3e 374 #define LL_TIM_CLOCKDIVISION_DIV1 ((uint32_t)0x00000000U) /*!< tDTS=tCK_INT */
Anna Bridge 186:707f6e361f3e 375 #define LL_TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< tDTS=2*tCK_INT */
Anna Bridge 186:707f6e361f3e 376 #define LL_TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< tDTS=4*tCK_INT */
Kojto 158:b23ee177fd68 377 /**
Kojto 158:b23ee177fd68 378 * @}
Kojto 158:b23ee177fd68 379 */
Kojto 158:b23ee177fd68 380
Kojto 158:b23ee177fd68 381 /** @defgroup TIM_LL_EC_COUNTERDIRECTION Counter Direction
Kojto 158:b23ee177fd68 382 * @{
Kojto 158:b23ee177fd68 383 */
Kojto 158:b23ee177fd68 384 #define LL_TIM_COUNTERDIRECTION_UP ((uint32_t)0x00000000U) /*!< Timer counter counts up */
Kojto 158:b23ee177fd68 385 #define LL_TIM_COUNTERDIRECTION_DOWN TIM_CR1_DIR /*!< Timer counter counts down */
Kojto 158:b23ee177fd68 386 /**
Kojto 158:b23ee177fd68 387 * @}
Kojto 158:b23ee177fd68 388 */
Kojto 158:b23ee177fd68 389
Kojto 158:b23ee177fd68 390
Kojto 158:b23ee177fd68 391 /** @defgroup TIM_LL_EC_CCDMAREQUEST Capture Compare DMA Request
Kojto 158:b23ee177fd68 392 * @{
Kojto 158:b23ee177fd68 393 */
Anna Bridge 186:707f6e361f3e 394 #define LL_TIM_CCDMAREQUEST_CC ((uint32_t)0x00000000U) /*!< CCx DMA request sent when CCx event occurs */
Anna Bridge 186:707f6e361f3e 395 #define LL_TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS /*!< CCx DMA requests sent when update event occurs */
Kojto 158:b23ee177fd68 396 /**
Kojto 158:b23ee177fd68 397 * @}
Kojto 158:b23ee177fd68 398 */
Kojto 158:b23ee177fd68 399
Kojto 158:b23ee177fd68 400
Kojto 158:b23ee177fd68 401 /** @defgroup TIM_LL_EC_CHANNEL Channel
Kojto 158:b23ee177fd68 402 * @{
Kojto 158:b23ee177fd68 403 */
Kojto 158:b23ee177fd68 404 #define LL_TIM_CHANNEL_CH1 TIM_CCER_CC1E /*!< Timer input/output channel 1 */
Kojto 158:b23ee177fd68 405 #define LL_TIM_CHANNEL_CH2 TIM_CCER_CC2E /*!< Timer input/output channel 2 */
Kojto 158:b23ee177fd68 406 #define LL_TIM_CHANNEL_CH3 TIM_CCER_CC3E /*!< Timer input/output channel 3 */
Kojto 158:b23ee177fd68 407 #define LL_TIM_CHANNEL_CH4 TIM_CCER_CC4E /*!< Timer input/output channel 4 */
Kojto 158:b23ee177fd68 408 /**
Kojto 158:b23ee177fd68 409 * @}
Kojto 158:b23ee177fd68 410 */
Kojto 158:b23ee177fd68 411
Kojto 158:b23ee177fd68 412 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 413 /** @defgroup TIM_LL_EC_OCSTATE Output Configuration State
Kojto 158:b23ee177fd68 414 * @{
Kojto 158:b23ee177fd68 415 */
Anna Bridge 186:707f6e361f3e 416 #define LL_TIM_OCSTATE_DISABLE ((uint32_t)0x00000000U) /*!< OCx is not active */
Anna Bridge 186:707f6e361f3e 417 #define LL_TIM_OCSTATE_ENABLE TIM_CCER_CC1E /*!< OCx signal is output on the corresponding output pin */
Kojto 158:b23ee177fd68 418 /**
Kojto 158:b23ee177fd68 419 * @}
Kojto 158:b23ee177fd68 420 */
Kojto 158:b23ee177fd68 421 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 422
Kojto 158:b23ee177fd68 423 /** @defgroup TIM_LL_EC_OCMODE Output Configuration Mode
Kojto 158:b23ee177fd68 424 * @{
Kojto 158:b23ee177fd68 425 */
Anna Bridge 186:707f6e361f3e 426 #define LL_TIM_OCMODE_FROZEN ((uint32_t)0x00000000U) /*!<The comparison between the output compare register TIMx_CCRy and the counter TIMx_CNT has no effect on the output channel level */
Anna Bridge 186:707f6e361f3e 427 #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/
Anna Bridge 186:707f6e361f3e 428 #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/
Anna Bridge 186:707f6e361f3e 429 #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/
Anna Bridge 186:707f6e361f3e 430 #define LL_TIM_OCMODE_FORCED_INACTIVE (TIM_CCMR1_OC1M_2) /*!<OCyREF is forced low*/
Anna Bridge 186:707f6e361f3e 431 #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/
Anna Bridge 186:707f6e361f3e 432 #define LL_TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!<In upcounting, channel y is active as long as TIMx_CNT<TIMx_CCRy else inactive. In downcounting, channel y is inactive as long as TIMx_CNT>TIMx_CCRy else active.*/
Anna Bridge 186:707f6e361f3e 433 #define LL_TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<In upcounting, channel y is inactive as long as TIMx_CNT<TIMx_CCRy else active. In downcounting, channel y is active as long as TIMx_CNT>TIMx_CCRy else inactive*/
Kojto 158:b23ee177fd68 434 /**
Kojto 158:b23ee177fd68 435 * @}
Kojto 158:b23ee177fd68 436 */
Kojto 158:b23ee177fd68 437
Kojto 158:b23ee177fd68 438 /** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity
Kojto 158:b23ee177fd68 439 * @{
Kojto 158:b23ee177fd68 440 */
Anna Bridge 186:707f6e361f3e 441 #define LL_TIM_OCPOLARITY_HIGH ((uint32_t)0x00000000U) /*!< OCxactive high*/
Anna Bridge 186:707f6e361f3e 442 #define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/
Kojto 158:b23ee177fd68 443 /**
Kojto 158:b23ee177fd68 444 * @}
Kojto 158:b23ee177fd68 445 */
Kojto 158:b23ee177fd68 446
Kojto 158:b23ee177fd68 447
Kojto 158:b23ee177fd68 448
Kojto 158:b23ee177fd68 449 /** @defgroup TIM_LL_EC_ACTIVEINPUT Active Input Selection
Kojto 158:b23ee177fd68 450 * @{
Kojto 158:b23ee177fd68 451 */
Anna Bridge 186:707f6e361f3e 452 #define LL_TIM_ACTIVEINPUT_DIRECTTI (uint32_t)(TIM_CCMR1_CC1S_0 << 16U) /*!< ICx is mapped on TIx */
Anna Bridge 186:707f6e361f3e 453 #define LL_TIM_ACTIVEINPUT_INDIRECTTI (uint32_t)(TIM_CCMR1_CC1S_1 << 16U) /*!< ICx is mapped on TIy */
Anna Bridge 186:707f6e361f3e 454 #define LL_TIM_ACTIVEINPUT_TRC (uint32_t)(TIM_CCMR1_CC1S << 16U) /*!< ICx is mapped on TRC */
Kojto 158:b23ee177fd68 455 /**
Kojto 158:b23ee177fd68 456 * @}
Kojto 158:b23ee177fd68 457 */
Kojto 158:b23ee177fd68 458
Kojto 158:b23ee177fd68 459 /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler
Kojto 158:b23ee177fd68 460 * @{
Kojto 158:b23ee177fd68 461 */
Anna Bridge 186:707f6e361f3e 462 #define LL_TIM_ICPSC_DIV1 ((uint32_t)0x00000000U) /*!< No prescaler, capture is done each time an edge is detected on the capture input */
Anna Bridge 186:707f6e361f3e 463 #define LL_TIM_ICPSC_DIV2 (uint32_t)(TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */
Anna Bridge 186:707f6e361f3e 464 #define LL_TIM_ICPSC_DIV4 (uint32_t)(TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */
Anna Bridge 186:707f6e361f3e 465 #define LL_TIM_ICPSC_DIV8 (uint32_t)(TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */
Kojto 158:b23ee177fd68 466 /**
Kojto 158:b23ee177fd68 467 * @}
Kojto 158:b23ee177fd68 468 */
Kojto 158:b23ee177fd68 469
Kojto 158:b23ee177fd68 470 /** @defgroup TIM_LL_EC_IC_FILTER Input Configuration Filter
Kojto 158:b23ee177fd68 471 * @{
Kojto 158:b23ee177fd68 472 */
Anna Bridge 186:707f6e361f3e 473 #define LL_TIM_IC_FILTER_FDIV1 ((uint32_t)0x00000000U) /*!< No filter, sampling is done at fDTS */
Anna Bridge 186:707f6e361f3e 474 #define LL_TIM_IC_FILTER_FDIV1_N2 (uint32_t)(TIM_CCMR1_IC1F_0 << 16U) /*!< fSAMPLING=fCK_INT, N=2 */
Anna Bridge 186:707f6e361f3e 475 #define LL_TIM_IC_FILTER_FDIV1_N4 (uint32_t)(TIM_CCMR1_IC1F_1 << 16U) /*!< fSAMPLING=fCK_INT, N=4 */
Anna Bridge 186:707f6e361f3e 476 #define LL_TIM_IC_FILTER_FDIV1_N8 (uint32_t)((TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fCK_INT, N=8 */
Anna Bridge 186:707f6e361f3e 477 #define LL_TIM_IC_FILTER_FDIV2_N6 (uint32_t)(TIM_CCMR1_IC1F_2 << 16U) /*!< fSAMPLING=fDTS/2, N=6 */
Anna Bridge 186:707f6e361f3e 478 #define LL_TIM_IC_FILTER_FDIV2_N8 (uint32_t)((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/2, N=8 */
Anna Bridge 186:707f6e361f3e 479 #define LL_TIM_IC_FILTER_FDIV4_N6 (uint32_t)((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/4, N=6 */
Anna Bridge 186:707f6e361f3e 480 #define LL_TIM_IC_FILTER_FDIV4_N8 (uint32_t)((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/4, N=8 */
Anna Bridge 186:707f6e361f3e 481 #define LL_TIM_IC_FILTER_FDIV8_N6 (uint32_t)(TIM_CCMR1_IC1F_3 << 16U) /*!< fSAMPLING=fDTS/8, N=6 */
Anna Bridge 186:707f6e361f3e 482 #define LL_TIM_IC_FILTER_FDIV8_N8 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/8, N=8 */
Anna Bridge 186:707f6e361f3e 483 #define LL_TIM_IC_FILTER_FDIV16_N5 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/16, N=5 */
Anna Bridge 186:707f6e361f3e 484 #define LL_TIM_IC_FILTER_FDIV16_N6 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/16, N=6 */
Anna Bridge 186:707f6e361f3e 485 #define LL_TIM_IC_FILTER_FDIV16_N8 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2) << 16U) /*!< fSAMPLING=fDTS/16, N=8 */
Anna Bridge 186:707f6e361f3e 486 #define LL_TIM_IC_FILTER_FDIV32_N5 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/32, N=5 */
Anna Bridge 186:707f6e361f3e 487 #define LL_TIM_IC_FILTER_FDIV32_N6 (uint32_t)((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/32, N=6 */
Anna Bridge 186:707f6e361f3e 488 #define LL_TIM_IC_FILTER_FDIV32_N8 (uint32_t)(TIM_CCMR1_IC1F << 16U) /*!< fSAMPLING=fDTS/32, N=8 */
Kojto 158:b23ee177fd68 489 /**
Kojto 158:b23ee177fd68 490 * @}
Kojto 158:b23ee177fd68 491 */
Kojto 158:b23ee177fd68 492
Kojto 158:b23ee177fd68 493 /** @defgroup TIM_LL_EC_IC_POLARITY Input Configuration Polarity
Kojto 158:b23ee177fd68 494 * @{
Kojto 158:b23ee177fd68 495 */
Anna Bridge 186:707f6e361f3e 496 #define LL_TIM_IC_POLARITY_RISING ((uint32_t)0x00000000U) /*!< The circuit is sensitive to TIxFP1 rising edge, TIxFP1 is not inverted */
Anna Bridge 186:707f6e361f3e 497 #define LL_TIM_IC_POLARITY_FALLING TIM_CCER_CC1P /*!< The circuit is sensitive to TIxFP1 falling edge, TIxFP1 is inverted */
Anna Bridge 186:707f6e361f3e 498 #define LL_TIM_IC_POLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP) /*!< The circuit is sensitive to both TIxFP1 rising and falling edges, TIxFP1 is not inverted */
Kojto 158:b23ee177fd68 499 /**
Kojto 158:b23ee177fd68 500 * @}
Kojto 158:b23ee177fd68 501 */
Kojto 158:b23ee177fd68 502
Kojto 158:b23ee177fd68 503 /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source
Kojto 158:b23ee177fd68 504 * @{
Kojto 158:b23ee177fd68 505 */
Kojto 158:b23ee177fd68 506 #define LL_TIM_CLOCKSOURCE_INTERNAL ((uint32_t)0x00000000U) /*!< The timer is clocked by the internal clock provided from the RCC */
Kojto 158:b23ee177fd68 507 #define LL_TIM_CLOCKSOURCE_EXT_MODE1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0 ) /*!< Counter counts at each rising or falling edge on a selected inpu t*/
Kojto 158:b23ee177fd68 508 #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */
Kojto 158:b23ee177fd68 509 /**
Kojto 158:b23ee177fd68 510 * @}
Kojto 158:b23ee177fd68 511 */
Kojto 158:b23ee177fd68 512
Kojto 158:b23ee177fd68 513 /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode
Kojto 158:b23ee177fd68 514 * @{
Kojto 158:b23ee177fd68 515 */
Anna Bridge 186:707f6e361f3e 516 #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Encoder mode 1 - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */
Anna Bridge 186:707f6e361f3e 517 #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Encoder mode 2 - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */
Kojto 158:b23ee177fd68 518 #define LL_TIM_ENCODERMODE_X4_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Encoder mode 3 - Counter counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input l */
Kojto 158:b23ee177fd68 519 /**
Kojto 158:b23ee177fd68 520 * @}
Kojto 158:b23ee177fd68 521 */
Kojto 158:b23ee177fd68 522
Kojto 158:b23ee177fd68 523 /** @defgroup TIM_LL_EC_TRGO Trigger Output
Kojto 158:b23ee177fd68 524 * @{
Kojto 158:b23ee177fd68 525 */
Anna Bridge 186:707f6e361f3e 526 #define LL_TIM_TRGO_RESET ((uint32_t)0x00000000U) /*!< UG bit from the TIMx_EGR register is used as trigger output */
Anna Bridge 186:707f6e361f3e 527 #define LL_TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< Counter Enable signal (CNT_EN) is used as trigger output */
Anna Bridge 186:707f6e361f3e 528 #define LL_TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output */
Anna Bridge 186:707f6e361f3e 529 #define LL_TIM_TRGO_CC1IF (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< CC1 capture or a compare match is used as trigger output */
Anna Bridge 186:707f6e361f3e 530 #define LL_TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output */
Anna Bridge 186:707f6e361f3e 531 #define LL_TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output */
Anna Bridge 186:707f6e361f3e 532 #define LL_TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output */
Anna Bridge 186:707f6e361f3e 533 #define LL_TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output */
Kojto 158:b23ee177fd68 534 /**
Kojto 158:b23ee177fd68 535 * @}
Kojto 158:b23ee177fd68 536 */
Kojto 158:b23ee177fd68 537
Kojto 158:b23ee177fd68 538
Kojto 158:b23ee177fd68 539 /** @defgroup TIM_LL_EC_SLAVEMODE Slave Mode
Kojto 158:b23ee177fd68 540 * @{
Kojto 158:b23ee177fd68 541 */
Anna Bridge 186:707f6e361f3e 542 #define LL_TIM_SLAVEMODE_DISABLED ((uint32_t)0x00000000U) /*!< Slave mode disabled */
Anna Bridge 186:707f6e361f3e 543 #define LL_TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode - Rising edge of the selected trigger input (TRGI) reinitializes the counter */
Anna Bridge 186:707f6e361f3e 544 #define LL_TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Gated Mode - The counter clock is enabled when the trigger input (TRGI) is high */
Anna Bridge 186:707f6e361f3e 545 #define LL_TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Trigger Mode - The counter starts at a rising edge of the trigger TRGI */
Kojto 158:b23ee177fd68 546 /**
Kojto 158:b23ee177fd68 547 * @}
Kojto 158:b23ee177fd68 548 */
Kojto 158:b23ee177fd68 549
Kojto 158:b23ee177fd68 550 /** @defgroup TIM_LL_EC_TS Trigger Selection
Kojto 158:b23ee177fd68 551 * @{
Kojto 158:b23ee177fd68 552 */
Anna Bridge 186:707f6e361f3e 553 #define LL_TIM_TS_ITR0 ((uint32_t)0x00000000U) /*!< Internal Trigger 0 (ITR0) is used as trigger input */
Anna Bridge 186:707f6e361f3e 554 #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */
Anna Bridge 186:707f6e361f3e 555 #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */
Anna Bridge 186:707f6e361f3e 556 #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */
Anna Bridge 186:707f6e361f3e 557 #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */
Anna Bridge 186:707f6e361f3e 558 #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */
Anna Bridge 186:707f6e361f3e 559 #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */
Anna Bridge 186:707f6e361f3e 560 #define LL_TIM_TS_ETRF (TIM_SMCR_TS_2 | TIM_SMCR_TS_1 | TIM_SMCR_TS_0) /*!< Filtered external Trigger (ETRF) is used as trigger input */
Kojto 158:b23ee177fd68 561 /**
Kojto 158:b23ee177fd68 562 * @}
Kojto 158:b23ee177fd68 563 */
Kojto 158:b23ee177fd68 564
Kojto 158:b23ee177fd68 565 /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity
Kojto 158:b23ee177fd68 566 * @{
Kojto 158:b23ee177fd68 567 */
Anna Bridge 186:707f6e361f3e 568 #define LL_TIM_ETR_POLARITY_NONINVERTED ((uint32_t)0x00000000U) /*!< ETR is non-inverted, active at high level or rising edge */
Anna Bridge 186:707f6e361f3e 569 #define LL_TIM_ETR_POLARITY_INVERTED TIM_SMCR_ETP /*!< ETR is inverted, active at low level or falling edge */
Kojto 158:b23ee177fd68 570 /**
Kojto 158:b23ee177fd68 571 * @}
Kojto 158:b23ee177fd68 572 */
Kojto 158:b23ee177fd68 573
Kojto 158:b23ee177fd68 574 /** @defgroup TIM_LL_EC_ETR_PRESCALER External Trigger Prescaler
Kojto 158:b23ee177fd68 575 * @{
Kojto 158:b23ee177fd68 576 */
Anna Bridge 186:707f6e361f3e 577 #define LL_TIM_ETR_PRESCALER_DIV1 ((uint32_t)0x00000000U) /*!< ETR prescaler OFF */
Anna Bridge 186:707f6e361f3e 578 #define LL_TIM_ETR_PRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR frequency is divided by 2 */
Anna Bridge 186:707f6e361f3e 579 #define LL_TIM_ETR_PRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR frequency is divided by 4 */
Anna Bridge 186:707f6e361f3e 580 #define LL_TIM_ETR_PRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR frequency is divided by 8 */
Kojto 158:b23ee177fd68 581 /**
Kojto 158:b23ee177fd68 582 * @}
Kojto 158:b23ee177fd68 583 */
Kojto 158:b23ee177fd68 584
Kojto 158:b23ee177fd68 585 /** @defgroup TIM_LL_EC_ETR_FILTER External Trigger Filter
Kojto 158:b23ee177fd68 586 * @{
Kojto 158:b23ee177fd68 587 */
Anna Bridge 186:707f6e361f3e 588 #define LL_TIM_ETR_FILTER_FDIV1 ((uint32_t)0x00000000U) /*!< No filter, sampling is done at fDTS */
Anna Bridge 186:707f6e361f3e 589 #define LL_TIM_ETR_FILTER_FDIV1_N2 TIM_SMCR_ETF_0 /*!< fSAMPLING=fCK_INT, N=2 */
Anna Bridge 186:707f6e361f3e 590 #define LL_TIM_ETR_FILTER_FDIV1_N4 TIM_SMCR_ETF_1 /*!< fSAMPLING=fCK_INT, N=4 */
Anna Bridge 186:707f6e361f3e 591 #define LL_TIM_ETR_FILTER_FDIV1_N8 (TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fCK_INT, N=8 */
Anna Bridge 186:707f6e361f3e 592 #define LL_TIM_ETR_FILTER_FDIV2_N6 TIM_SMCR_ETF_2 /*!< fSAMPLING=fDTS/2, N=6 */
Anna Bridge 186:707f6e361f3e 593 #define LL_TIM_ETR_FILTER_FDIV2_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/2, N=8 */
Anna Bridge 186:707f6e361f3e 594 #define LL_TIM_ETR_FILTER_FDIV4_N6 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1 ) /*!< fSAMPLING=fDTS/4, N=6 */
Anna Bridge 186:707f6e361f3e 595 #define LL_TIM_ETR_FILTER_FDIV4_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/4, N=8 */
Anna Bridge 186:707f6e361f3e 596 #define LL_TIM_ETR_FILTER_FDIV8_N6 TIM_SMCR_ETF_3 /*!< fSAMPLING=fDTS/8, N=8 */
Anna Bridge 186:707f6e361f3e 597 #define LL_TIM_ETR_FILTER_FDIV8_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=5 */
Anna Bridge 186:707f6e361f3e 598 #define LL_TIM_ETR_FILTER_FDIV16_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1 ) /*!< fSAMPLING=fDTS/16, N=6 */
Anna Bridge 186:707f6e361f3e 599 #define LL_TIM_ETR_FILTER_FDIV16_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=8 */
Anna Bridge 186:707f6e361f3e 600 #define LL_TIM_ETR_FILTER_FDIV16_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 ) /*!< fSAMPLING=fDTS/16, N=5 */
Anna Bridge 186:707f6e361f3e 601 #define LL_TIM_ETR_FILTER_FDIV32_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/32, N=5 */
Anna Bridge 186:707f6e361f3e 602 #define LL_TIM_ETR_FILTER_FDIV32_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/32, N=6 */
Anna Bridge 186:707f6e361f3e 603 #define LL_TIM_ETR_FILTER_FDIV32_N8 TIM_SMCR_ETF /*!< fSAMPLING=fDTS/32, N=8 */
Kojto 158:b23ee177fd68 604 /**
Kojto 158:b23ee177fd68 605 * @}
Kojto 158:b23ee177fd68 606 */
Kojto 158:b23ee177fd68 607
Kojto 158:b23ee177fd68 608
Kojto 158:b23ee177fd68 609
Kojto 158:b23ee177fd68 610
Kojto 158:b23ee177fd68 611
Kojto 158:b23ee177fd68 612
Kojto 158:b23ee177fd68 613
Kojto 158:b23ee177fd68 614 /** @defgroup TIM_LL_EC_DMABURST_BASEADDR DMA Burst Base Address
Kojto 158:b23ee177fd68 615 * @{
Kojto 158:b23ee177fd68 616 */
Anna Bridge 186:707f6e361f3e 617 #define LL_TIM_DMABURST_BASEADDR_CR1 ((uint32_t)0x00000000U) /*!< TIMx_CR1 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 618 #define LL_TIM_DMABURST_BASEADDR_CR2 TIM_DCR_DBA_0 /*!< TIMx_CR2 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 619 #define LL_TIM_DMABURST_BASEADDR_SMCR TIM_DCR_DBA_1 /*!< TIMx_SMCR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 620 #define LL_TIM_DMABURST_BASEADDR_DIER (TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_DIER register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 621 #define LL_TIM_DMABURST_BASEADDR_SR TIM_DCR_DBA_2 /*!< TIMx_SR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 622 #define LL_TIM_DMABURST_BASEADDR_EGR (TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_EGR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 623 #define LL_TIM_DMABURST_BASEADDR_CCMR1 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCMR1 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 624 #define LL_TIM_DMABURST_BASEADDR_CCMR2 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCMR2 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 625 #define LL_TIM_DMABURST_BASEADDR_CCER TIM_DCR_DBA_3 /*!< TIMx_CCER register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 626 #define LL_TIM_DMABURST_BASEADDR_CNT (TIM_DCR_DBA_3 | TIM_DCR_DBA_0) /*!< TIMx_CNT register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 627 #define LL_TIM_DMABURST_BASEADDR_PSC (TIM_DCR_DBA_3 | TIM_DCR_DBA_1) /*!< TIMx_PSC register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 628 #define LL_TIM_DMABURST_BASEADDR_ARR (TIM_DCR_DBA_3 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_ARR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 629 #define LL_TIM_DMABURST_BASEADDR_RCR (TIM_DCR_DBA_3 | TIM_DCR_DBA_2) /*!< TIMx_RCR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 630 #define LL_TIM_DMABURST_BASEADDR_CCR1 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_CCR1 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 631 #define LL_TIM_DMABURST_BASEADDR_CCR2 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCR2 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 632 #define LL_TIM_DMABURST_BASEADDR_CCR3 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCR3 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 633 #define LL_TIM_DMABURST_BASEADDR_CCR4 TIM_DCR_DBA_4 /*!< TIMx_CCR4 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 634 #define LL_TIM_DMABURST_BASEADDR_BDTR (TIM_DCR_DBA_4 | TIM_DCR_DBA_0) /*!< TIMx_BDTR register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 635 #define LL_TIM_DMABURST_BASEADDR_CCMR3 (TIM_DCR_DBA_4 | TIM_DCR_DBA_1) /*!< TIMx_CCMR3 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 636 #define LL_TIM_DMABURST_BASEADDR_CCR5 (TIM_DCR_DBA_4 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCR5 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 637 #define LL_TIM_DMABURST_BASEADDR_CCR6 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2) /*!< TIMx_CCR6 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 638 #define LL_TIM_DMABURST_BASEADDR_OR1 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_OR1 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 639 #define LL_TIM_DMABURST_BASEADDR_OR2 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_OR2 register is the DMA base address for DMA burst */
Anna Bridge 186:707f6e361f3e 640 #define LL_TIM_DMABURST_BASEADDR_OR3 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_OR3 register is the DMA base address for DMA burst */
Kojto 158:b23ee177fd68 641 /**
Kojto 158:b23ee177fd68 642 * @}
Kojto 158:b23ee177fd68 643 */
Kojto 158:b23ee177fd68 644
Kojto 158:b23ee177fd68 645 /** @defgroup TIM_LL_EC_DMABURST_LENGTH DMA Burst Length
Kojto 158:b23ee177fd68 646 * @{
Kojto 158:b23ee177fd68 647 */
Anna Bridge 186:707f6e361f3e 648 #define LL_TIM_DMABURST_LENGTH_1TRANSFER ((uint32_t)0x00000000U) /*!< Transfer is done to 1 register starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 649 #define LL_TIM_DMABURST_LENGTH_2TRANSFERS TIM_DCR_DBL_0 /*!< Transfer is done to 2 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 650 #define LL_TIM_DMABURST_LENGTH_3TRANSFERS TIM_DCR_DBL_1 /*!< Transfer is done to 3 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 651 #define LL_TIM_DMABURST_LENGTH_4TRANSFERS (TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 4 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 652 #define LL_TIM_DMABURST_LENGTH_5TRANSFERS TIM_DCR_DBL_2 /*!< Transfer is done to 5 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 653 #define LL_TIM_DMABURST_LENGTH_6TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 6 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 654 #define LL_TIM_DMABURST_LENGTH_7TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 7 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 655 #define LL_TIM_DMABURST_LENGTH_8TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 1 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 656 #define LL_TIM_DMABURST_LENGTH_9TRANSFERS TIM_DCR_DBL_3 /*!< Transfer is done to 9 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 657 #define LL_TIM_DMABURST_LENGTH_10TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_0) /*!< Transfer is done to 10 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 658 #define LL_TIM_DMABURST_LENGTH_11TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1) /*!< Transfer is done to 11 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 659 #define LL_TIM_DMABURST_LENGTH_12TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 12 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 660 #define LL_TIM_DMABURST_LENGTH_13TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2) /*!< Transfer is done to 13 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 661 #define LL_TIM_DMABURST_LENGTH_14TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 14 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 662 #define LL_TIM_DMABURST_LENGTH_15TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 15 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 663 #define LL_TIM_DMABURST_LENGTH_16TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 16 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 664 #define LL_TIM_DMABURST_LENGTH_17TRANSFERS TIM_DCR_DBL_4 /*!< Transfer is done to 17 registers starting from the DMA burst base address */
Anna Bridge 186:707f6e361f3e 665 #define LL_TIM_DMABURST_LENGTH_18TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_0) /*!< Transfer is done to 18 registers starting from the DMA burst base address */
Kojto 158:b23ee177fd68 666 /**
Kojto 158:b23ee177fd68 667 * @}
Kojto 158:b23ee177fd68 668 */
Kojto 158:b23ee177fd68 669
Kojto 158:b23ee177fd68 670
Anna Bridge 186:707f6e361f3e 671 /** @defgroup TIM_LL_EC_TIM2_ETR_RMP TIM2 External Trigger Remap
Kojto 158:b23ee177fd68 672 * @{
Kojto 158:b23ee177fd68 673 */
Anna Bridge 186:707f6e361f3e 674 #define LL_TIM_TIM2_ETR_RMP_GPIO ((uint32_t)0x00000000U | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to Ored GPIO */
Kojto 158:b23ee177fd68 675 #if defined(TIM_TIM2_REMAP_HSI_SUPPORT)
Anna Bridge 186:707f6e361f3e 676 #define LL_TIM_TIM2_ETR_RMP_HSI (TIM2_OR_ETR_RMP_1 | TIM2_OR_ETR_RMP_0 | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to HSI */
Kojto 158:b23ee177fd68 677 #endif /* defined(TIM_TIM2_REMAP_HSI_SUPPORT) */
Kojto 158:b23ee177fd68 678 #if defined(TIM_TIM2_REMAP_HSI48_SUPPORT)
Anna Bridge 186:707f6e361f3e 679 #define LL_TIM_TIM2_ETR_RMP_HSI48 (TIM2_OR_ETR_RMP_2 | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to HSI48 */
Kojto 158:b23ee177fd68 680 #endif /* defined(TIM_TIM2_REMAP_HSI48_SUPPORT) */
Anna Bridge 186:707f6e361f3e 681 #define LL_TIM_TIM2_ETR_RMP_LSE (TIM2_OR_ETR_RMP_2 | TIM2_OR_ETR_RMP_0 | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to LSE */
Anna Bridge 186:707f6e361f3e 682 #define LL_TIM_TIM2_ETR_RMP_COMP2 (TIM2_OR_ETR_RMP_2 | TIM2_OR_ETR_RMP_1 | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to COMP2_OUT */
Anna Bridge 186:707f6e361f3e 683 #define LL_TIM_TIM2_ETR_RMP_COMP1 (TIM2_OR_ETR_RMP | TIM2_OR_RMP_MASK) /*!< TIM2_ETR is connected to COMP1_OUT */
Kojto 158:b23ee177fd68 684
Kojto 158:b23ee177fd68 685 /**
Kojto 158:b23ee177fd68 686 * @}
Kojto 158:b23ee177fd68 687 */
Anna Bridge 186:707f6e361f3e 688
Kojto 158:b23ee177fd68 689 /** @defgroup TIM_LL_EC_TIM2_TI4_RMP TIM2 Timer Input Ch4 Remap
Kojto 158:b23ee177fd68 690 * @{
Kojto 158:b23ee177fd68 691 */
Anna Bridge 186:707f6e361f3e 692 #define LL_TIM_TIM2_TI4_RMP_GPIO ((uint32_t)0x00000000U | TIM2_OR_RMP_MASK) /*!< TIM2 input capture 4 is connected to GPIO */
Anna Bridge 186:707f6e361f3e 693 #define LL_TIM_TIM2_TI4_RMP_COMP2 (TIM2_OR_TI4_RMP_0 | TIM2_OR_RMP_MASK) /*!< TIM2 input capture 4 is connected to COMP2_OUT */
Anna Bridge 186:707f6e361f3e 694 #define LL_TIM_TIM2_TI4_RMP_COMP1 (TIM2_OR_TI4_RMP_1 | TIM2_OR_RMP_MASK) /*!< TIM2 input capture 4 is connected to COMP1_OUT */
Kojto 158:b23ee177fd68 695 /**
Kojto 158:b23ee177fd68 696 * @}
Kojto 158:b23ee177fd68 697 */
Kojto 158:b23ee177fd68 698
Kojto 158:b23ee177fd68 699 #if defined(TIM3_OR_ETR_RMP)
Anna Bridge 186:707f6e361f3e 700 /** @defgroup TIM_LL_EC_TIM3_ETR_RMP TIM3 External Trigger Remap
Kojto 158:b23ee177fd68 701 * @{
Kojto 158:b23ee177fd68 702 */
Anna Bridge 186:707f6e361f3e 703 #define LL_TIM_TIM3_ETR_RMP_GPIO ((uint32_t)0x00000000U | TIM3_OR_RMP_MASK) /*!< TIM3_ETR is connected to GPIO */
Anna Bridge 186:707f6e361f3e 704 #define LL_TIM_TIM3_ETR_RMP_HSI48DIV6 (TIM3_OR_ETR_RMP_1 | TIM3_OR_RMP_MASK) /*!< TIM3_ETR is connected to HSI48 divided by 6 */
Kojto 158:b23ee177fd68 705 /**
Kojto 158:b23ee177fd68 706 * @}
Kojto 158:b23ee177fd68 707 */
Anna Bridge 186:707f6e361f3e 708 #endif /* defined(TIM3_OR_ETR_RMP) */
Anna Bridge 186:707f6e361f3e 709
Anna Bridge 186:707f6e361f3e 710 #if defined(TIM3_OR_TI1_RMP) || defined(TIM3_OR_TI2_RMP) || defined(TIM3_OR_TI4_RMP)
Kojto 158:b23ee177fd68 711 /** @defgroup TIM_LL_EC_TIM3_TI_RMP TIM3 External Inputs Remap
Kojto 158:b23ee177fd68 712 * @{
Kojto 158:b23ee177fd68 713 */
Anna Bridge 186:707f6e361f3e 714 #define LL_TIM_TIM3_TI_RMP_TI1_USB_SOF ((uint32_t)0x00000000U | TIM3_OR_RMP_MASK) /*!< TIM3_TI1 input is connected to USB_SOF */
Anna Bridge 186:707f6e361f3e 715 #define LL_TIM_TIM3_TI_RMP_TI1_GPIO (TIM3_OR_TI1_RMP | TIM3_OR_RMP_MASK) /*!< TIM3_TI1 input is connected to PE3, PA6, PC6 or PB4 */
Anna Bridge 186:707f6e361f3e 716
Anna Bridge 186:707f6e361f3e 717 #define LL_TIM_TIM3_TI_RMP_TI2_GPIO_DEF ((uint32_t)0x00000000U | TIM3_OR_RMP_MASK) /*!< Mapping PB5 to TIM22_CH2 */
Anna Bridge 186:707f6e361f3e 718 #define LL_TIM_TIM3_TI_RMP_TI2_GPIOB5_AF4 (TIM3_OR_TI2_RMP | TIM3_OR_RMP_MASK) /*!< Mapping PB5 to TIM3_CH2 */
Anna Bridge 186:707f6e361f3e 719
Anna Bridge 186:707f6e361f3e 720 #define LL_TIM_TIM3_TI_RMP_TI4_GPIO_DEF ((uint32_t)0x00000000U | TIM3_OR_RMP_MASK) /*!< Mapping PC9 to USB_OE */
Anna Bridge 186:707f6e361f3e 721 #define LL_TIM_TIM3_TI_RMP_TI4_GPIOC9_AF2 (TIM3_OR_TI4_RMP | TIM3_OR_RMP_MASK) /*!< Mapping PC9 to TIM3_CH4 */
Kojto 158:b23ee177fd68 722 /**
Kojto 158:b23ee177fd68 723 * @}
Kojto 158:b23ee177fd68 724 */
Kojto 158:b23ee177fd68 725 #endif /*defined(TIM3_OR_TI1_RMP) or defined(TIM3_OR_TI2_RMP) or defined(TIM3_OR_TI4_RMP)*/
Kojto 158:b23ee177fd68 726
Anna Bridge 186:707f6e361f3e 727 /** @defgroup TIM_LL_EC_TIM21_ETR_RMP TIM21 External Trigger Remap
Kojto 158:b23ee177fd68 728 * @{
Kojto 158:b23ee177fd68 729 */
Anna Bridge 186:707f6e361f3e 730 #define LL_TIM_TIM21_ETR_RMP_GPIO ((uint32_t)0x00000000U | TIM21_OR_RMP_MASK) /*!< TIM21_ETR is connected to Ored GPIO1 */
Anna Bridge 186:707f6e361f3e 731 #define LL_TIM_TIM21_ETR_RMP_COMP2 (TIM21_OR_ETR_RMP_0 | TIM21_OR_RMP_MASK) /*!< TIM21_ETR is connected to COMP2_OUT */
Anna Bridge 186:707f6e361f3e 732 #define LL_TIM_TIM21_ETR_RMP_COMP1 (TIM21_OR_ETR_RMP_1 | TIM21_OR_RMP_MASK) /*!< TIM21_ETR is connected to COMP1_OUT */
Anna Bridge 186:707f6e361f3e 733 #define LL_TIM_TIM21_ETR_RMP_LSE (TIM21_OR_ETR_RMP | TIM21_OR_RMP_MASK) /*!< TIM21_ETR is connected to LSE */
Kojto 158:b23ee177fd68 734 /**
Kojto 158:b23ee177fd68 735 * @}
Kojto 158:b23ee177fd68 736 */
Kojto 158:b23ee177fd68 737
Anna Bridge 186:707f6e361f3e 738 /** @defgroup TIM_LL_EC_TIM21_TI1_RMP TIM21 External Input Ch1 Remap
Kojto 158:b23ee177fd68 739 * @{
Kojto 158:b23ee177fd68 740 */
Anna Bridge 186:707f6e361f3e 741 #define LL_TIM_TIM21_TI1_RMP_GPIO ((uint32_t)0x00000000U | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to Ored GPIO1 */
Anna Bridge 186:707f6e361f3e 742 #define LL_TIM_TIM21_TI1_RMP_RTC_WK (TIM21_OR_TI1_RMP_0 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to RTC_WAKEUP */
Anna Bridge 186:707f6e361f3e 743 #define LL_TIM_TIM21_TI1_RMP_HSE_RTC (TIM21_OR_TI1_RMP_1 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to HSE_RTC */
Anna Bridge 186:707f6e361f3e 744 #define LL_TIM_TIM21_TI1_RMP_MSI (TIM21_OR_TI1_RMP_1 | TIM21_OR_TI1_RMP_0 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to MSI */
Anna Bridge 186:707f6e361f3e 745 #define LL_TIM_TIM21_TI1_RMP_LSE (TIM21_OR_TI1_RMP_2 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to LSE */
Anna Bridge 186:707f6e361f3e 746 #define LL_TIM_TIM21_TI1_RMP_LSI (TIM21_OR_TI1_RMP_2 | TIM21_OR_TI1_RMP_0 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to LSI */
Anna Bridge 186:707f6e361f3e 747 #define LL_TIM_TIM21_TI1_RMP_COMP1 (TIM21_OR_TI1_RMP_2 | TIM21_OR_TI1_RMP_1 | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to COMP1_OUT */
Anna Bridge 186:707f6e361f3e 748 #define LL_TIM_TIM21_TI1_RMP_MCO (TIM21_OR_TI1_RMP | TIM21_OR_RMP_MASK) /*!< TIM21_TI1 is connected to MCO */
Kojto 158:b23ee177fd68 749 /**
Kojto 158:b23ee177fd68 750 * @}
Kojto 158:b23ee177fd68 751 */
Kojto 158:b23ee177fd68 752
Anna Bridge 186:707f6e361f3e 753 /** @defgroup TIM_LL_EC_TIM21_TI2_RMP TIM21 External Input Ch2 Remap
Kojto 158:b23ee177fd68 754 * @{
Kojto 158:b23ee177fd68 755 */
Anna Bridge 186:707f6e361f3e 756 #define LL_TIM_TIM21_TI2_RMP_GPIO ((uint32_t)0x00000000U | TIM21_OR_RMP_MASK) /*!< TIM21_TI2 is connected to Ored GPIO1 */
Anna Bridge 186:707f6e361f3e 757 #define LL_TIM_TIM21_TI2_RMP_COMP2 (TIM21_OR_TI2_RMP | TIM21_OR_RMP_MASK) /*!< TIM21_TI2 is connected to COMP2_OUT */
Kojto 158:b23ee177fd68 758 /**
Kojto 158:b23ee177fd68 759 * @}
Kojto 158:b23ee177fd68 760 */
Kojto 158:b23ee177fd68 761
Anna Bridge 186:707f6e361f3e 762 #if defined(TIM22_OR_ETR_RMP)
Anna Bridge 186:707f6e361f3e 763
Anna Bridge 186:707f6e361f3e 764 /** @defgroup TIM_LL_EC_TIM22_ETR_RMP TIM22 External Trigger Remap
Kojto 158:b23ee177fd68 765 * @{
Kojto 158:b23ee177fd68 766 */
Anna Bridge 186:707f6e361f3e 767 #define LL_TIM_TIM22_ETR_RMP_GPIO ((uint32_t)0x00000000U | TIM22_OR_RMP_MASK) /*!< TIM22_ETR is connected to GPIO */
Anna Bridge 186:707f6e361f3e 768 #define LL_TIM_TIM22_ETR_RMP_COMP2 (TIM22_OR_ETR_RMP_0 | TIM22_OR_RMP_MASK) /*!< TIM22_ETR is connected to COMP2_OUT */
Anna Bridge 186:707f6e361f3e 769 #define LL_TIM_TIM22_ETR_RMP_COMP1 (TIM22_OR_ETR_RMP_1 | TIM22_OR_RMP_MASK) /*!< TIM22_ETR is connected to COMP1_OUT */
Anna Bridge 186:707f6e361f3e 770 #define LL_TIM_TIM22_ETR_RMP_LSE (TIM22_OR_ETR_RMP | TIM22_OR_RMP_MASK) /*!< TIM22_ETR is connected to LSE */
Kojto 158:b23ee177fd68 771 /**
Kojto 158:b23ee177fd68 772 * @}
Kojto 158:b23ee177fd68 773 */
Anna Bridge 186:707f6e361f3e 774 #endif /* defined(TIM22_OR_ETR_RMP) */
Anna Bridge 186:707f6e361f3e 775
Anna Bridge 186:707f6e361f3e 776 #if defined(TIM22_OR_TI1_RMP)
Anna Bridge 186:707f6e361f3e 777 /** @defgroup TIM_LL_EC_TIM22_TI1_RMP TIM22 External Input Ch1 Remap
Kojto 158:b23ee177fd68 778 * @{
Kojto 158:b23ee177fd68 779 */
Anna Bridge 186:707f6e361f3e 780 #define LL_TIM_TIM22_TI1_RMP_GPIO1 ((uint32_t)0x00000000U | TIM22_OR_RMP_MASK) /*!< TIM22_TI1 is connected to GPIO1 */
Anna Bridge 186:707f6e361f3e 781 #define LL_TIM_TIM22_TI1_RMP_COMP2 (TIM22_OR_TI1_RMP_0 | TIM22_OR_RMP_MASK) /*!< TIM22_TI1 is connected to COMP2_OUT */
Anna Bridge 186:707f6e361f3e 782 #define LL_TIM_TIM22_TI1_RMP_COMP1 (TIM22_OR_TI1_RMP_1 | TIM22_OR_RMP_MASK) /*!< TIM22_TI1 is connected to COMP1_OUT */
Anna Bridge 186:707f6e361f3e 783 #define LL_TIM_TIM22_TI1_RMP_GPIO2 (TIM22_OR_TI1_RMP | TIM22_OR_RMP_MASK) /*!< TIM22_TI1 is connected to GPIO2 */
Kojto 158:b23ee177fd68 784 /**
Kojto 158:b23ee177fd68 785 * @}
Kojto 158:b23ee177fd68 786 */
Anna Bridge 186:707f6e361f3e 787 #endif /* defined(TIM22_OR_TI1_RMP) */
Kojto 158:b23ee177fd68 788
Kojto 158:b23ee177fd68 789
Kojto 158:b23ee177fd68 790 /** @defgroup TIM_LL_EC_OCREF_CLR_INT OCREF clear input selection
Kojto 158:b23ee177fd68 791 * @{
Kojto 158:b23ee177fd68 792 */
Anna Bridge 186:707f6e361f3e 793 #define LL_TIM_OCREF_CLR_INT_NC ((uint32_t)0x00000000U ) /*!< OCREF_CLR_INT is not connected */
Anna Bridge 186:707f6e361f3e 794 #define LL_TIM_OCREF_CLR_INT_ETR TIM_SMCR_OCCS /*!< OCREF_CLR_INT is connected to ETRF */
Kojto 158:b23ee177fd68 795 /**
Kojto 158:b23ee177fd68 796 * @}
Kojto 158:b23ee177fd68 797 */
Kojto 158:b23ee177fd68 798
Kojto 158:b23ee177fd68 799 /**
Kojto 158:b23ee177fd68 800 * @}
Kojto 158:b23ee177fd68 801 */
Anna Bridge 186:707f6e361f3e 802
Kojto 158:b23ee177fd68 803 /* Exported macro ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 804 /** @defgroup TIM_LL_Exported_Macros TIM Exported Macros
Kojto 158:b23ee177fd68 805 * @{
Kojto 158:b23ee177fd68 806 */
Kojto 158:b23ee177fd68 807
Kojto 158:b23ee177fd68 808 /** @defgroup TIM_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 158:b23ee177fd68 809 * @{
Kojto 158:b23ee177fd68 810 */
Kojto 158:b23ee177fd68 811 /**
Kojto 158:b23ee177fd68 812 * @brief Write a value in TIM register.
Kojto 158:b23ee177fd68 813 * @param __INSTANCE__ TIM Instance
Kojto 158:b23ee177fd68 814 * @param __REG__ Register to be written
Kojto 158:b23ee177fd68 815 * @param __VALUE__ Value to be written in the register
Kojto 158:b23ee177fd68 816 * @retval None
Kojto 158:b23ee177fd68 817 */
Kojto 158:b23ee177fd68 818 #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 158:b23ee177fd68 819
Kojto 158:b23ee177fd68 820 /**
Kojto 158:b23ee177fd68 821 * @brief Read a value in TIM register.
Kojto 158:b23ee177fd68 822 * @param __INSTANCE__ TIM Instance
Kojto 158:b23ee177fd68 823 * @param __REG__ Register to be read
Kojto 158:b23ee177fd68 824 * @retval Register value
Kojto 158:b23ee177fd68 825 */
Kojto 158:b23ee177fd68 826 #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 158:b23ee177fd68 827 /**
Kojto 158:b23ee177fd68 828 * @}
Kojto 158:b23ee177fd68 829 */
Kojto 158:b23ee177fd68 830
Kojto 158:b23ee177fd68 831 /** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros
Kojto 158:b23ee177fd68 832 * @{
Kojto 158:b23ee177fd68 833 */
Kojto 158:b23ee177fd68 834
Kojto 158:b23ee177fd68 835
Kojto 158:b23ee177fd68 836 /**
Kojto 158:b23ee177fd68 837 * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency.
Kojto 158:b23ee177fd68 838 * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000);
Kojto 158:b23ee177fd68 839 * @param __TIMCLK__ timer input clock frequency (in Hz)
Kojto 158:b23ee177fd68 840 * @param __CNTCLK__ counter clock frequency (in Hz)
Kojto 158:b23ee177fd68 841 * @retval Prescaler value (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 842 */
Kojto 158:b23ee177fd68 843 #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \
Kojto 158:b23ee177fd68 844 ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U
Kojto 158:b23ee177fd68 845
Kojto 158:b23ee177fd68 846 /**
Kojto 158:b23ee177fd68 847 * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency.
Kojto 158:b23ee177fd68 848 * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000);
Kojto 158:b23ee177fd68 849 * @param __TIMCLK__ timer input clock frequency (in Hz)
Kojto 158:b23ee177fd68 850 * @param __PSC__ prescaler
Kojto 158:b23ee177fd68 851 * @param __FREQ__ output signal frequency (in Hz)
Kojto 158:b23ee177fd68 852 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 853 */
Kojto 158:b23ee177fd68 854 #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \
Kojto 158:b23ee177fd68 855 (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U
Kojto 158:b23ee177fd68 856
Kojto 158:b23ee177fd68 857 /**
Kojto 158:b23ee177fd68 858 * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay.
Kojto 158:b23ee177fd68 859 * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10);
Kojto 158:b23ee177fd68 860 * @param __TIMCLK__ timer input clock frequency (in Hz)
Kojto 158:b23ee177fd68 861 * @param __PSC__ prescaler
Kojto 158:b23ee177fd68 862 * @param __DELAY__ timer output compare active/inactive delay (in us)
Kojto 158:b23ee177fd68 863 * @retval Compare value (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 864 */
Kojto 158:b23ee177fd68 865 #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \
Kojto 158:b23ee177fd68 866 ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \
Kojto 158:b23ee177fd68 867 / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))
Kojto 158:b23ee177fd68 868
Kojto 158:b23ee177fd68 869 /**
Kojto 158:b23ee177fd68 870 * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode).
Kojto 158:b23ee177fd68 871 * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20);
Kojto 158:b23ee177fd68 872 * @param __TIMCLK__ timer input clock frequency (in Hz)
Kojto 158:b23ee177fd68 873 * @param __PSC__ prescaler
Kojto 158:b23ee177fd68 874 * @param __DELAY__ timer output compare active/inactive delay (in us)
Kojto 158:b23ee177fd68 875 * @param __PULSE__ pulse duration (in us)
Kojto 158:b23ee177fd68 876 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 877 */
Kojto 158:b23ee177fd68 878 #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \
Kojto 158:b23ee177fd68 879 ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \
Kojto 158:b23ee177fd68 880 + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__))))
Kojto 158:b23ee177fd68 881
Kojto 158:b23ee177fd68 882 /**
Anna Bridge 186:707f6e361f3e 883 * @brief HELPER macro retrieving the ratio of the input capture prescaler
Kojto 158:b23ee177fd68 884 * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ());
Kojto 158:b23ee177fd68 885 * @param __ICPSC__ This parameter can be one of the following values:
Kojto 158:b23ee177fd68 886 * @arg @ref LL_TIM_ICPSC_DIV1
Kojto 158:b23ee177fd68 887 * @arg @ref LL_TIM_ICPSC_DIV2
Kojto 158:b23ee177fd68 888 * @arg @ref LL_TIM_ICPSC_DIV4
Kojto 158:b23ee177fd68 889 * @arg @ref LL_TIM_ICPSC_DIV8
Kojto 158:b23ee177fd68 890 * @retval Input capture prescaler ratio (1, 2, 4 or 8)
Kojto 158:b23ee177fd68 891 */
Kojto 158:b23ee177fd68 892 #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \
Anna Bridge 186:707f6e361f3e 893 ((uint32_t)((uint32_t)0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos)))
Anna Bridge 186:707f6e361f3e 894
Anna Bridge 186:707f6e361f3e 895
Kojto 158:b23ee177fd68 896 /**
Kojto 158:b23ee177fd68 897 * @}
Kojto 158:b23ee177fd68 898 */
Kojto 158:b23ee177fd68 899
Kojto 158:b23ee177fd68 900
Kojto 158:b23ee177fd68 901 /**
Kojto 158:b23ee177fd68 902 * @}
Kojto 158:b23ee177fd68 903 */
Kojto 158:b23ee177fd68 904
Kojto 158:b23ee177fd68 905 /* Exported functions --------------------------------------------------------*/
Kojto 158:b23ee177fd68 906 /** @defgroup TIM_LL_Exported_Functions TIM Exported Functions
Kojto 158:b23ee177fd68 907 * @{
Kojto 158:b23ee177fd68 908 */
Anna Bridge 186:707f6e361f3e 909
Kojto 158:b23ee177fd68 910 /** @defgroup TIM_LL_EF_Time_Base Time Base configuration
Kojto 158:b23ee177fd68 911 * @{
Kojto 158:b23ee177fd68 912 */
Kojto 158:b23ee177fd68 913 /**
Kojto 158:b23ee177fd68 914 * @brief Enable timer counter.
Kojto 158:b23ee177fd68 915 * @rmtoll CR1 CEN LL_TIM_EnableCounter
Kojto 158:b23ee177fd68 916 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 917 * @retval None
Kojto 158:b23ee177fd68 918 */
Anna Bridge 186:707f6e361f3e 919 __STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 920 {
Kojto 158:b23ee177fd68 921 SET_BIT(TIMx->CR1, TIM_CR1_CEN);
Kojto 158:b23ee177fd68 922 }
Kojto 158:b23ee177fd68 923
Kojto 158:b23ee177fd68 924 /**
Kojto 158:b23ee177fd68 925 * @brief Disable timer counter.
Kojto 158:b23ee177fd68 926 * @rmtoll CR1 CEN LL_TIM_DisableCounter
Kojto 158:b23ee177fd68 927 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 928 * @retval None
Kojto 158:b23ee177fd68 929 */
Anna Bridge 186:707f6e361f3e 930 __STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 931 {
Kojto 158:b23ee177fd68 932 CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN);
Kojto 158:b23ee177fd68 933 }
Kojto 158:b23ee177fd68 934
Kojto 158:b23ee177fd68 935 /**
Kojto 158:b23ee177fd68 936 * @brief Indicates whether the timer counter is enabled.
Kojto 158:b23ee177fd68 937 * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter
Kojto 158:b23ee177fd68 938 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 939 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 940 */
Anna Bridge 186:707f6e361f3e 941 __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 942 {
Kojto 158:b23ee177fd68 943 return (READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN));
Kojto 158:b23ee177fd68 944 }
Kojto 158:b23ee177fd68 945
Kojto 158:b23ee177fd68 946 /**
Kojto 158:b23ee177fd68 947 * @brief Enable update event generation.
Kojto 158:b23ee177fd68 948 * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent
Kojto 158:b23ee177fd68 949 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 950 * @retval None
Kojto 158:b23ee177fd68 951 */
Anna Bridge 186:707f6e361f3e 952 __STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 953 {
Kojto 158:b23ee177fd68 954 SET_BIT(TIMx->CR1, TIM_CR1_UDIS);
Kojto 158:b23ee177fd68 955 }
Kojto 158:b23ee177fd68 956
Kojto 158:b23ee177fd68 957 /**
Kojto 158:b23ee177fd68 958 * @brief Disable update event generation.
Kojto 158:b23ee177fd68 959 * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent
Kojto 158:b23ee177fd68 960 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 961 * @retval None
Kojto 158:b23ee177fd68 962 */
Anna Bridge 186:707f6e361f3e 963 __STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 964 {
Kojto 158:b23ee177fd68 965 CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS);
Kojto 158:b23ee177fd68 966 }
Kojto 158:b23ee177fd68 967
Kojto 158:b23ee177fd68 968 /**
Kojto 158:b23ee177fd68 969 * @brief Indicates whether update event generation is enabled.
Kojto 158:b23ee177fd68 970 * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent
Kojto 158:b23ee177fd68 971 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 972 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 973 */
Anna Bridge 186:707f6e361f3e 974 __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 975 {
Kojto 158:b23ee177fd68 976 return (READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (TIM_CR1_UDIS));
Kojto 158:b23ee177fd68 977 }
Kojto 158:b23ee177fd68 978
Kojto 158:b23ee177fd68 979 /**
Kojto 158:b23ee177fd68 980 * @brief Set update event source
Anna Bridge 186:707f6e361f3e 981 * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events
Kojto 158:b23ee177fd68 982 * generate an update interrupt or DMA request if enabled:
Kojto 158:b23ee177fd68 983 * - Counter overflow/underflow
Kojto 158:b23ee177fd68 984 * - Setting the UG bit
Kojto 158:b23ee177fd68 985 * - Update generation through the slave mode controller
Anna Bridge 186:707f6e361f3e 986 * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter
Kojto 158:b23ee177fd68 987 * overflow/underflow generates an update interrupt or DMA request if enabled.
Kojto 158:b23ee177fd68 988 * @rmtoll CR1 URS LL_TIM_SetUpdateSource
Kojto 158:b23ee177fd68 989 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 990 * @param UpdateSource This parameter can be one of the following values:
Kojto 158:b23ee177fd68 991 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
Kojto 158:b23ee177fd68 992 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
Kojto 158:b23ee177fd68 993 * @retval None
Kojto 158:b23ee177fd68 994 */
Anna Bridge 186:707f6e361f3e 995 __STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource)
Kojto 158:b23ee177fd68 996 {
Kojto 158:b23ee177fd68 997 MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource);
Kojto 158:b23ee177fd68 998 }
Kojto 158:b23ee177fd68 999
Kojto 158:b23ee177fd68 1000 /**
Kojto 158:b23ee177fd68 1001 * @brief Get actual event update source
Kojto 158:b23ee177fd68 1002 * @rmtoll CR1 URS LL_TIM_GetUpdateSource
Kojto 158:b23ee177fd68 1003 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1004 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1005 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
Kojto 158:b23ee177fd68 1006 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
Kojto 158:b23ee177fd68 1007 */
Anna Bridge 186:707f6e361f3e 1008 __STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1009 {
Kojto 158:b23ee177fd68 1010 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS));
Kojto 158:b23ee177fd68 1011 }
Kojto 158:b23ee177fd68 1012
Kojto 158:b23ee177fd68 1013 /**
Kojto 158:b23ee177fd68 1014 * @brief Set one pulse mode (one shot v.s. repetitive).
Kojto 158:b23ee177fd68 1015 * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode
Kojto 158:b23ee177fd68 1016 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1017 * @param OnePulseMode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1018 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
Kojto 158:b23ee177fd68 1019 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
Kojto 158:b23ee177fd68 1020 * @retval None
Kojto 158:b23ee177fd68 1021 */
Anna Bridge 186:707f6e361f3e 1022 __STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode)
Kojto 158:b23ee177fd68 1023 {
Kojto 158:b23ee177fd68 1024 MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode);
Kojto 158:b23ee177fd68 1025 }
Kojto 158:b23ee177fd68 1026
Kojto 158:b23ee177fd68 1027 /**
Kojto 158:b23ee177fd68 1028 * @brief Get actual one pulse mode.
Kojto 158:b23ee177fd68 1029 * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode
Kojto 158:b23ee177fd68 1030 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1031 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1032 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
Kojto 158:b23ee177fd68 1033 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
Kojto 158:b23ee177fd68 1034 */
Anna Bridge 186:707f6e361f3e 1035 __STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1036 {
Kojto 158:b23ee177fd68 1037 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM));
Kojto 158:b23ee177fd68 1038 }
Kojto 158:b23ee177fd68 1039
Kojto 158:b23ee177fd68 1040 /**
Kojto 158:b23ee177fd68 1041 * @brief Set the timer counter counting mode.
Kojto 158:b23ee177fd68 1042 * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
Anna Bridge 186:707f6e361f3e 1043 * check whether or not the counter mode selection feature is supported
Kojto 158:b23ee177fd68 1044 * by a timer instance.
Kojto 158:b23ee177fd68 1045 * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n
Kojto 158:b23ee177fd68 1046 * CR1 CMS LL_TIM_SetCounterMode
Kojto 158:b23ee177fd68 1047 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1048 * @param CounterMode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1049 * @arg @ref LL_TIM_COUNTERMODE_UP
Kojto 158:b23ee177fd68 1050 * @arg @ref LL_TIM_COUNTERMODE_DOWN
Kojto 158:b23ee177fd68 1051 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
Kojto 158:b23ee177fd68 1052 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
Kojto 158:b23ee177fd68 1053 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
Kojto 158:b23ee177fd68 1054 * @retval None
Kojto 158:b23ee177fd68 1055 */
Anna Bridge 186:707f6e361f3e 1056 __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode)
Kojto 158:b23ee177fd68 1057 {
Kojto 158:b23ee177fd68 1058 MODIFY_REG(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS, CounterMode);
Kojto 158:b23ee177fd68 1059 }
Kojto 158:b23ee177fd68 1060
Kojto 158:b23ee177fd68 1061 /**
Kojto 158:b23ee177fd68 1062 * @brief Get actual counter mode.
Kojto 158:b23ee177fd68 1063 * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
Anna Bridge 186:707f6e361f3e 1064 * check whether or not the counter mode selection feature is supported
Kojto 158:b23ee177fd68 1065 * by a timer instance.
Kojto 158:b23ee177fd68 1066 * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n
Kojto 158:b23ee177fd68 1067 * CR1 CMS LL_TIM_GetCounterMode
Kojto 158:b23ee177fd68 1068 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1069 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1070 * @arg @ref LL_TIM_COUNTERMODE_UP
Kojto 158:b23ee177fd68 1071 * @arg @ref LL_TIM_COUNTERMODE_DOWN
Kojto 158:b23ee177fd68 1072 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
Kojto 158:b23ee177fd68 1073 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
Kojto 158:b23ee177fd68 1074 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
Kojto 158:b23ee177fd68 1075 */
Anna Bridge 186:707f6e361f3e 1076 __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1077 {
Kojto 158:b23ee177fd68 1078 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS));
Kojto 158:b23ee177fd68 1079 }
Kojto 158:b23ee177fd68 1080
Kojto 158:b23ee177fd68 1081 /**
Kojto 158:b23ee177fd68 1082 * @brief Enable auto-reload (ARR) preload.
Kojto 158:b23ee177fd68 1083 * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload
Kojto 158:b23ee177fd68 1084 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1085 * @retval None
Kojto 158:b23ee177fd68 1086 */
Anna Bridge 186:707f6e361f3e 1087 __STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1088 {
Kojto 158:b23ee177fd68 1089 SET_BIT(TIMx->CR1, TIM_CR1_ARPE);
Kojto 158:b23ee177fd68 1090 }
Kojto 158:b23ee177fd68 1091
Kojto 158:b23ee177fd68 1092 /**
Kojto 158:b23ee177fd68 1093 * @brief Disable auto-reload (ARR) preload.
Kojto 158:b23ee177fd68 1094 * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload
Kojto 158:b23ee177fd68 1095 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1096 * @retval None
Kojto 158:b23ee177fd68 1097 */
Anna Bridge 186:707f6e361f3e 1098 __STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1099 {
Kojto 158:b23ee177fd68 1100 CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE);
Kojto 158:b23ee177fd68 1101 }
Kojto 158:b23ee177fd68 1102
Kojto 158:b23ee177fd68 1103 /**
Kojto 158:b23ee177fd68 1104 * @brief Indicates whether auto-reload (ARR) preload is enabled.
Kojto 158:b23ee177fd68 1105 * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload
Kojto 158:b23ee177fd68 1106 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1107 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1108 */
Anna Bridge 186:707f6e361f3e 1109 __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1110 {
Kojto 158:b23ee177fd68 1111 return (READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE));
Kojto 158:b23ee177fd68 1112 }
Kojto 158:b23ee177fd68 1113
Kojto 158:b23ee177fd68 1114 /**
Kojto 158:b23ee177fd68 1115 * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
Anna Bridge 186:707f6e361f3e 1116 * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 1117 * whether or not the clock division feature is supported by the timer
Kojto 158:b23ee177fd68 1118 * instance.
Kojto 158:b23ee177fd68 1119 * @rmtoll CR1 CKD LL_TIM_SetClockDivision
Kojto 158:b23ee177fd68 1120 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1121 * @param ClockDivision This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1122 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
Kojto 158:b23ee177fd68 1123 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
Kojto 158:b23ee177fd68 1124 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
Kojto 158:b23ee177fd68 1125 * @retval None
Kojto 158:b23ee177fd68 1126 */
Anna Bridge 186:707f6e361f3e 1127 __STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision)
Kojto 158:b23ee177fd68 1128 {
Kojto 158:b23ee177fd68 1129 MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision);
Kojto 158:b23ee177fd68 1130 }
Kojto 158:b23ee177fd68 1131
Kojto 158:b23ee177fd68 1132 /**
Kojto 158:b23ee177fd68 1133 * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
Anna Bridge 186:707f6e361f3e 1134 * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 1135 * whether or not the clock division feature is supported by the timer
Kojto 158:b23ee177fd68 1136 * instance.
Kojto 158:b23ee177fd68 1137 * @rmtoll CR1 CKD LL_TIM_GetClockDivision
Kojto 158:b23ee177fd68 1138 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1139 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1140 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
Kojto 158:b23ee177fd68 1141 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
Kojto 158:b23ee177fd68 1142 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
Kojto 158:b23ee177fd68 1143 */
Anna Bridge 186:707f6e361f3e 1144 __STATIC_INLINE uint32_t LL_TIM_GetClockDivision(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1145 {
Kojto 158:b23ee177fd68 1146 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD));
Kojto 158:b23ee177fd68 1147 }
Kojto 158:b23ee177fd68 1148
Kojto 158:b23ee177fd68 1149 /**
Kojto 158:b23ee177fd68 1150 * @brief Set the counter value.
Kojto 158:b23ee177fd68 1151 * @rmtoll CNT CNT LL_TIM_SetCounter
Kojto 158:b23ee177fd68 1152 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1153 * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF)
Kojto 158:b23ee177fd68 1154 * @retval None
Kojto 158:b23ee177fd68 1155 */
Anna Bridge 186:707f6e361f3e 1156 __STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter)
Kojto 158:b23ee177fd68 1157 {
Kojto 158:b23ee177fd68 1158 WRITE_REG(TIMx->CNT, Counter);
Kojto 158:b23ee177fd68 1159 }
Kojto 158:b23ee177fd68 1160
Kojto 158:b23ee177fd68 1161 /**
Kojto 158:b23ee177fd68 1162 * @brief Get the counter value.
Kojto 158:b23ee177fd68 1163 * @rmtoll CNT CNT LL_TIM_GetCounter
Kojto 158:b23ee177fd68 1164 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1165 * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF)
Kojto 158:b23ee177fd68 1166 */
Anna Bridge 186:707f6e361f3e 1167 __STATIC_INLINE uint32_t LL_TIM_GetCounter(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1168 {
Kojto 158:b23ee177fd68 1169 return (uint32_t)(READ_REG(TIMx->CNT));
Kojto 158:b23ee177fd68 1170 }
Kojto 158:b23ee177fd68 1171
Kojto 158:b23ee177fd68 1172 /**
Kojto 158:b23ee177fd68 1173 * @brief Get the current direction of the counter
Kojto 158:b23ee177fd68 1174 * @rmtoll CR1 DIR LL_TIM_GetDirection
Kojto 158:b23ee177fd68 1175 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1176 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1177 * @arg @ref LL_TIM_COUNTERDIRECTION_UP
Kojto 158:b23ee177fd68 1178 * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN
Kojto 158:b23ee177fd68 1179 */
Anna Bridge 186:707f6e361f3e 1180 __STATIC_INLINE uint32_t LL_TIM_GetDirection(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1181 {
Kojto 158:b23ee177fd68 1182 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR));
Kojto 158:b23ee177fd68 1183 }
Kojto 158:b23ee177fd68 1184
Kojto 158:b23ee177fd68 1185 /**
Kojto 158:b23ee177fd68 1186 * @brief Set the prescaler value.
Kojto 158:b23ee177fd68 1187 * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1).
Kojto 158:b23ee177fd68 1188 * @note The prescaler can be changed on the fly as this control register is buffered. The new
Kojto 158:b23ee177fd68 1189 * prescaler ratio is taken into account at the next update event.
Kojto 158:b23ee177fd68 1190 * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter
Kojto 158:b23ee177fd68 1191 * @rmtoll PSC PSC LL_TIM_SetPrescaler
Kojto 158:b23ee177fd68 1192 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1193 * @param Prescaler between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1194 * @retval None
Kojto 158:b23ee177fd68 1195 */
Anna Bridge 186:707f6e361f3e 1196 __STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler)
Kojto 158:b23ee177fd68 1197 {
Kojto 158:b23ee177fd68 1198 WRITE_REG(TIMx->PSC, Prescaler);
Kojto 158:b23ee177fd68 1199 }
Kojto 158:b23ee177fd68 1200
Kojto 158:b23ee177fd68 1201 /**
Kojto 158:b23ee177fd68 1202 * @brief Get the prescaler value.
Kojto 158:b23ee177fd68 1203 * @rmtoll PSC PSC LL_TIM_GetPrescaler
Kojto 158:b23ee177fd68 1204 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1205 * @retval Prescaler value between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1206 */
Anna Bridge 186:707f6e361f3e 1207 __STATIC_INLINE uint32_t LL_TIM_GetPrescaler(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1208 {
Kojto 158:b23ee177fd68 1209 return (uint32_t)(READ_REG(TIMx->PSC));
Kojto 158:b23ee177fd68 1210 }
Kojto 158:b23ee177fd68 1211
Kojto 158:b23ee177fd68 1212 /**
Kojto 158:b23ee177fd68 1213 * @brief Set the auto-reload value.
Kojto 158:b23ee177fd68 1214 * @note The counter is blocked while the auto-reload value is null.
Kojto 158:b23ee177fd68 1215 * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter
Kojto 158:b23ee177fd68 1216 * @rmtoll ARR ARR LL_TIM_SetAutoReload
Kojto 158:b23ee177fd68 1217 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1218 * @param AutoReload between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1219 * @retval None
Kojto 158:b23ee177fd68 1220 */
Anna Bridge 186:707f6e361f3e 1221 __STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload)
Kojto 158:b23ee177fd68 1222 {
Kojto 158:b23ee177fd68 1223 WRITE_REG(TIMx->ARR, AutoReload);
Kojto 158:b23ee177fd68 1224 }
Kojto 158:b23ee177fd68 1225
Kojto 158:b23ee177fd68 1226 /**
Kojto 158:b23ee177fd68 1227 * @brief Get the auto-reload value.
Kojto 158:b23ee177fd68 1228 * @rmtoll ARR ARR LL_TIM_GetAutoReload
Kojto 158:b23ee177fd68 1229 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1230 * @retval Auto-reload value
Kojto 158:b23ee177fd68 1231 */
Anna Bridge 186:707f6e361f3e 1232 __STATIC_INLINE uint32_t LL_TIM_GetAutoReload(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1233 {
Kojto 158:b23ee177fd68 1234 return (uint32_t)(READ_REG(TIMx->ARR));
Kojto 158:b23ee177fd68 1235 }
Kojto 158:b23ee177fd68 1236
Kojto 158:b23ee177fd68 1237 /**
Kojto 158:b23ee177fd68 1238 * @}
Kojto 158:b23ee177fd68 1239 */
Kojto 158:b23ee177fd68 1240
Kojto 158:b23ee177fd68 1241 /** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration
Kojto 158:b23ee177fd68 1242 * @{
Kojto 158:b23ee177fd68 1243 */
Kojto 158:b23ee177fd68 1244 /**
Kojto 158:b23ee177fd68 1245 * @brief Set the trigger of the capture/compare DMA request.
Kojto 158:b23ee177fd68 1246 * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger
Kojto 158:b23ee177fd68 1247 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1248 * @param DMAReqTrigger This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1249 * @arg @ref LL_TIM_CCDMAREQUEST_CC
Kojto 158:b23ee177fd68 1250 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
Kojto 158:b23ee177fd68 1251 * @retval None
Kojto 158:b23ee177fd68 1252 */
Anna Bridge 186:707f6e361f3e 1253 __STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger)
Kojto 158:b23ee177fd68 1254 {
Kojto 158:b23ee177fd68 1255 MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger);
Kojto 158:b23ee177fd68 1256 }
Kojto 158:b23ee177fd68 1257
Kojto 158:b23ee177fd68 1258 /**
Kojto 158:b23ee177fd68 1259 * @brief Get actual trigger of the capture/compare DMA request.
Kojto 158:b23ee177fd68 1260 * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger
Kojto 158:b23ee177fd68 1261 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1262 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1263 * @arg @ref LL_TIM_CCDMAREQUEST_CC
Kojto 158:b23ee177fd68 1264 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
Kojto 158:b23ee177fd68 1265 */
Anna Bridge 186:707f6e361f3e 1266 __STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1267 {
Kojto 158:b23ee177fd68 1268 return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS));
Kojto 158:b23ee177fd68 1269 }
Kojto 158:b23ee177fd68 1270
Kojto 158:b23ee177fd68 1271 /**
Kojto 158:b23ee177fd68 1272 * @brief Enable capture/compare channels.
Kojto 158:b23ee177fd68 1273 * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n
Kojto 158:b23ee177fd68 1274 * CCER CC2E LL_TIM_CC_EnableChannel\n
Kojto 158:b23ee177fd68 1275 * CCER CC3E LL_TIM_CC_EnableChannel\n
Kojto 158:b23ee177fd68 1276 * CCER CC4E LL_TIM_CC_EnableChannel
Kojto 158:b23ee177fd68 1277 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1278 * @param Channels This parameter can be a combination of the following values:
Kojto 158:b23ee177fd68 1279 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1280 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1281 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1282 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1283 * @retval None
Kojto 158:b23ee177fd68 1284 */
Anna Bridge 186:707f6e361f3e 1285 __STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
Kojto 158:b23ee177fd68 1286 {
Kojto 158:b23ee177fd68 1287 SET_BIT(TIMx->CCER, Channels);
Kojto 158:b23ee177fd68 1288 }
Kojto 158:b23ee177fd68 1289
Kojto 158:b23ee177fd68 1290 /**
Kojto 158:b23ee177fd68 1291 * @brief Disable capture/compare channels.
Kojto 158:b23ee177fd68 1292 * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n
Kojto 158:b23ee177fd68 1293 * CCER CC2E LL_TIM_CC_DisableChannel\n
Kojto 158:b23ee177fd68 1294 * CCER CC3E LL_TIM_CC_DisableChannel\n
Kojto 158:b23ee177fd68 1295 * CCER CC4E LL_TIM_CC_DisableChannel
Kojto 158:b23ee177fd68 1296 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1297 * @param Channels This parameter can be a combination of the following values:
Kojto 158:b23ee177fd68 1298 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1299 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1300 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1301 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1302 * @retval None
Kojto 158:b23ee177fd68 1303 */
Anna Bridge 186:707f6e361f3e 1304 __STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
Kojto 158:b23ee177fd68 1305 {
Kojto 158:b23ee177fd68 1306 CLEAR_BIT(TIMx->CCER, Channels);
Kojto 158:b23ee177fd68 1307 }
Kojto 158:b23ee177fd68 1308
Kojto 158:b23ee177fd68 1309 /**
Kojto 158:b23ee177fd68 1310 * @brief Indicate whether channel(s) is(are) enabled.
Kojto 158:b23ee177fd68 1311 * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n
Kojto 158:b23ee177fd68 1312 * CCER CC2E LL_TIM_CC_IsEnabledChannel\n
Kojto 158:b23ee177fd68 1313 * CCER CC3E LL_TIM_CC_IsEnabledChannel\n
Kojto 158:b23ee177fd68 1314 * CCER CC4E LL_TIM_CC_IsEnabledChannel
Kojto 158:b23ee177fd68 1315 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1316 * @param Channels This parameter can be a combination of the following values:
Kojto 158:b23ee177fd68 1317 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1318 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1319 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1320 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1321 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1322 */
Anna Bridge 186:707f6e361f3e 1323 __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels)
Kojto 158:b23ee177fd68 1324 {
Anna Bridge 186:707f6e361f3e 1325 return (READ_BIT(TIMx->CCER, Channels) == (Channels));
Kojto 158:b23ee177fd68 1326 }
Kojto 158:b23ee177fd68 1327
Kojto 158:b23ee177fd68 1328 /**
Kojto 158:b23ee177fd68 1329 * @}
Kojto 158:b23ee177fd68 1330 */
Kojto 158:b23ee177fd68 1331
Kojto 158:b23ee177fd68 1332 /** @defgroup TIM_LL_EF_Output_Channel Output channel configuration
Kojto 158:b23ee177fd68 1333 * @{
Kojto 158:b23ee177fd68 1334 */
Kojto 158:b23ee177fd68 1335 /**
Kojto 158:b23ee177fd68 1336 * @brief Configure an output channel.
Kojto 158:b23ee177fd68 1337 * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1338 * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1339 * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1340 * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1341 * CCER CC1P LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1342 * CCER CC2P LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1343 * CCER CC3P LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1344 * CCER CC4P LL_TIM_OC_ConfigOutput\n
Kojto 158:b23ee177fd68 1345 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1346 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1347 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1348 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1349 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1350 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1351 * @param Configuration This parameter must be a combination of all the following values:
Kojto 158:b23ee177fd68 1352 * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW
Kojto 158:b23ee177fd68 1353 * @retval None
Kojto 158:b23ee177fd68 1354 */
Anna Bridge 186:707f6e361f3e 1355 __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
Kojto 158:b23ee177fd68 1356 {
Kojto 158:b23ee177fd68 1357 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1358 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1359 CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel]));
Anna Bridge 186:707f6e361f3e 1360 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]),
Anna Bridge 186:707f6e361f3e 1361 (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 1362 }
Kojto 158:b23ee177fd68 1363
Kojto 158:b23ee177fd68 1364 /**
Kojto 158:b23ee177fd68 1365 * @brief Define the behavior of the output reference signal OCxREF from which
Kojto 158:b23ee177fd68 1366 * OCx and OCxN (when relevant) are derived.
Kojto 158:b23ee177fd68 1367 * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n
Kojto 158:b23ee177fd68 1368 * CCMR1 OC2M LL_TIM_OC_SetMode\n
Kojto 158:b23ee177fd68 1369 * CCMR2 OC3M LL_TIM_OC_SetMode\n
Kojto 158:b23ee177fd68 1370 * CCMR2 OC4M LL_TIM_OC_SetMode
Kojto 158:b23ee177fd68 1371 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1372 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1373 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1374 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1375 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1376 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1377 * @param Mode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1378 * @arg @ref LL_TIM_OCMODE_FROZEN
Kojto 158:b23ee177fd68 1379 * @arg @ref LL_TIM_OCMODE_ACTIVE
Kojto 158:b23ee177fd68 1380 * @arg @ref LL_TIM_OCMODE_INACTIVE
Kojto 158:b23ee177fd68 1381 * @arg @ref LL_TIM_OCMODE_TOGGLE
Kojto 158:b23ee177fd68 1382 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
Kojto 158:b23ee177fd68 1383 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
Kojto 158:b23ee177fd68 1384 * @arg @ref LL_TIM_OCMODE_PWM1
Kojto 158:b23ee177fd68 1385 * @arg @ref LL_TIM_OCMODE_PWM2
Kojto 158:b23ee177fd68 1386 * @retval None
Kojto 158:b23ee177fd68 1387 */
Anna Bridge 186:707f6e361f3e 1388 __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode)
Kojto 158:b23ee177fd68 1389 {
Kojto 158:b23ee177fd68 1390 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1391 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1392 MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]);
Kojto 158:b23ee177fd68 1393 }
Kojto 158:b23ee177fd68 1394
Kojto 158:b23ee177fd68 1395 /**
Kojto 158:b23ee177fd68 1396 * @brief Get the output compare mode of an output channel.
Kojto 158:b23ee177fd68 1397 * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n
Kojto 158:b23ee177fd68 1398 * CCMR1 OC2M LL_TIM_OC_GetMode\n
Kojto 158:b23ee177fd68 1399 * CCMR2 OC3M LL_TIM_OC_GetMode\n
Kojto 158:b23ee177fd68 1400 * CCMR2 OC4M LL_TIM_OC_GetMode
Kojto 158:b23ee177fd68 1401 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1402 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1403 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1404 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1405 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1406 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1407 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1408 * @arg @ref LL_TIM_OCMODE_FROZEN
Kojto 158:b23ee177fd68 1409 * @arg @ref LL_TIM_OCMODE_ACTIVE
Kojto 158:b23ee177fd68 1410 * @arg @ref LL_TIM_OCMODE_INACTIVE
Kojto 158:b23ee177fd68 1411 * @arg @ref LL_TIM_OCMODE_TOGGLE
Kojto 158:b23ee177fd68 1412 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
Kojto 158:b23ee177fd68 1413 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
Kojto 158:b23ee177fd68 1414 * @arg @ref LL_TIM_OCMODE_PWM1
Kojto 158:b23ee177fd68 1415 * @arg @ref LL_TIM_OCMODE_PWM2
Kojto 158:b23ee177fd68 1416 */
Anna Bridge 186:707f6e361f3e 1417 __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1418 {
Kojto 158:b23ee177fd68 1419 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1420 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1421 return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]);
Kojto 158:b23ee177fd68 1422 }
Kojto 158:b23ee177fd68 1423
Kojto 158:b23ee177fd68 1424 /**
Kojto 158:b23ee177fd68 1425 * @brief Set the polarity of an output channel.
Kojto 158:b23ee177fd68 1426 * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n
Kojto 158:b23ee177fd68 1427 * CCER CC2P LL_TIM_OC_SetPolarity\n
Kojto 158:b23ee177fd68 1428 * CCER CC3P LL_TIM_OC_SetPolarity\n
Kojto 158:b23ee177fd68 1429 * CCER CC4P LL_TIM_OC_SetPolarity
Kojto 158:b23ee177fd68 1430 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1431 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1432 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1433 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1434 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1435 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1436 * @param Polarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1437 * @arg @ref LL_TIM_OCPOLARITY_HIGH
Kojto 158:b23ee177fd68 1438 * @arg @ref LL_TIM_OCPOLARITY_LOW
Kojto 158:b23ee177fd68 1439 * @retval None
Kojto 158:b23ee177fd68 1440 */
Anna Bridge 186:707f6e361f3e 1441 __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity)
Kojto 158:b23ee177fd68 1442 {
Kojto 158:b23ee177fd68 1443 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Kojto 158:b23ee177fd68 1444 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 1445 }
Kojto 158:b23ee177fd68 1446
Kojto 158:b23ee177fd68 1447 /**
Kojto 158:b23ee177fd68 1448 * @brief Get the polarity of an output channel.
Kojto 158:b23ee177fd68 1449 * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n
Kojto 158:b23ee177fd68 1450 * CCER CC2P LL_TIM_OC_GetPolarity\n
Kojto 158:b23ee177fd68 1451 * CCER CC3P LL_TIM_OC_GetPolarity\n
Kojto 158:b23ee177fd68 1452 * CCER CC4P LL_TIM_OC_GetPolarity
Kojto 158:b23ee177fd68 1453 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1454 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1455 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1456 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1457 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1458 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1459 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1460 * @arg @ref LL_TIM_OCPOLARITY_HIGH
Kojto 158:b23ee177fd68 1461 * @arg @ref LL_TIM_OCPOLARITY_LOW
Kojto 158:b23ee177fd68 1462 */
Anna Bridge 186:707f6e361f3e 1463 __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1464 {
Kojto 158:b23ee177fd68 1465 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Kojto 158:b23ee177fd68 1466 return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 1467 }
Kojto 158:b23ee177fd68 1468
Kojto 158:b23ee177fd68 1469 /**
Kojto 158:b23ee177fd68 1470 * @brief Enable fast mode for the output channel.
Kojto 158:b23ee177fd68 1471 * @note Acts only if the channel is configured in PWM1 or PWM2 mode.
Kojto 158:b23ee177fd68 1472 * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n
Kojto 158:b23ee177fd68 1473 * CCMR1 OC2FE LL_TIM_OC_EnableFast\n
Kojto 158:b23ee177fd68 1474 * CCMR2 OC3FE LL_TIM_OC_EnableFast\n
Kojto 158:b23ee177fd68 1475 * CCMR2 OC4FE LL_TIM_OC_EnableFast
Kojto 158:b23ee177fd68 1476 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1477 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1478 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1479 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1480 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1481 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1482 * @retval None
Kojto 158:b23ee177fd68 1483 */
Anna Bridge 186:707f6e361f3e 1484 __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1485 {
Kojto 158:b23ee177fd68 1486 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1487 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1488 SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1489
Kojto 158:b23ee177fd68 1490 }
Kojto 158:b23ee177fd68 1491
Kojto 158:b23ee177fd68 1492 /**
Kojto 158:b23ee177fd68 1493 * @brief Disable fast mode for the output channel.
Kojto 158:b23ee177fd68 1494 * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n
Kojto 158:b23ee177fd68 1495 * CCMR1 OC2FE LL_TIM_OC_DisableFast\n
Kojto 158:b23ee177fd68 1496 * CCMR2 OC3FE LL_TIM_OC_DisableFast\n
Kojto 158:b23ee177fd68 1497 * CCMR2 OC4FE LL_TIM_OC_DisableFast
Kojto 158:b23ee177fd68 1498 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1499 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1500 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1501 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1502 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1503 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1504 * @retval None
Kojto 158:b23ee177fd68 1505 */
Anna Bridge 186:707f6e361f3e 1506 __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1507 {
Kojto 158:b23ee177fd68 1508 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1509 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1510 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1511
Kojto 158:b23ee177fd68 1512 }
Kojto 158:b23ee177fd68 1513
Kojto 158:b23ee177fd68 1514 /**
Kojto 158:b23ee177fd68 1515 * @brief Indicates whether fast mode is enabled for the output channel.
Kojto 158:b23ee177fd68 1516 * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n
Kojto 158:b23ee177fd68 1517 * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n
Kojto 158:b23ee177fd68 1518 * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n
Kojto 158:b23ee177fd68 1519 * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n
Kojto 158:b23ee177fd68 1520 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1521 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1522 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1523 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1524 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1525 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1526 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1527 */
Anna Bridge 186:707f6e361f3e 1528 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1529 {
Kojto 158:b23ee177fd68 1530 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1531 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1532 register uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel];
Kojto 158:b23ee177fd68 1533 return (READ_BIT(*pReg, bitfield) == bitfield);
Kojto 158:b23ee177fd68 1534 }
Kojto 158:b23ee177fd68 1535
Kojto 158:b23ee177fd68 1536 /**
Kojto 158:b23ee177fd68 1537 * @brief Enable compare register (TIMx_CCRx) preload for the output channel.
Kojto 158:b23ee177fd68 1538 * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n
Kojto 158:b23ee177fd68 1539 * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n
Kojto 158:b23ee177fd68 1540 * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n
Kojto 158:b23ee177fd68 1541 * CCMR2 OC4PE LL_TIM_OC_EnablePreload
Kojto 158:b23ee177fd68 1542 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1543 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1544 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1545 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1546 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1547 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1548 * @retval None
Kojto 158:b23ee177fd68 1549 */
Anna Bridge 186:707f6e361f3e 1550 __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1551 {
Kojto 158:b23ee177fd68 1552 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1553 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1554 SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1555 }
Kojto 158:b23ee177fd68 1556
Kojto 158:b23ee177fd68 1557 /**
Kojto 158:b23ee177fd68 1558 * @brief Disable compare register (TIMx_CCRx) preload for the output channel.
Kojto 158:b23ee177fd68 1559 * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n
Kojto 158:b23ee177fd68 1560 * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n
Kojto 158:b23ee177fd68 1561 * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n
Kojto 158:b23ee177fd68 1562 * CCMR2 OC4PE LL_TIM_OC_DisablePreload
Kojto 158:b23ee177fd68 1563 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1564 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1565 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1566 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1567 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1568 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1569 * @retval None
Kojto 158:b23ee177fd68 1570 */
Anna Bridge 186:707f6e361f3e 1571 __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1572 {
Kojto 158:b23ee177fd68 1573 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1574 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1575 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1576 }
Kojto 158:b23ee177fd68 1577
Kojto 158:b23ee177fd68 1578 /**
Kojto 158:b23ee177fd68 1579 * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel.
Kojto 158:b23ee177fd68 1580 * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n
Kojto 158:b23ee177fd68 1581 * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n
Kojto 158:b23ee177fd68 1582 * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n
Kojto 158:b23ee177fd68 1583 * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n
Kojto 158:b23ee177fd68 1584 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1585 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1586 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1587 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1588 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1589 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1590 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1591 */
Anna Bridge 186:707f6e361f3e 1592 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1593 {
Kojto 158:b23ee177fd68 1594 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1595 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1596 register uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel];
Kojto 158:b23ee177fd68 1597 return (READ_BIT(*pReg, bitfield) == bitfield);
Kojto 158:b23ee177fd68 1598 }
Kojto 158:b23ee177fd68 1599
Kojto 158:b23ee177fd68 1600 /**
Kojto 158:b23ee177fd68 1601 * @brief Enable clearing the output channel on an external event.
Kojto 158:b23ee177fd68 1602 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
Kojto 158:b23ee177fd68 1603 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
Kojto 158:b23ee177fd68 1604 * or not a timer instance can clear the OCxREF signal on an external event.
Kojto 158:b23ee177fd68 1605 * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n
Kojto 158:b23ee177fd68 1606 * CCMR1 OC2CE LL_TIM_OC_EnableClear\n
Kojto 158:b23ee177fd68 1607 * CCMR2 OC3CE LL_TIM_OC_EnableClear\n
Kojto 158:b23ee177fd68 1608 * CCMR2 OC4CE LL_TIM_OC_EnableClear
Kojto 158:b23ee177fd68 1609 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1610 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1611 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1612 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1613 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1614 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1615 * @retval None
Kojto 158:b23ee177fd68 1616 */
Anna Bridge 186:707f6e361f3e 1617 __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1618 {
Kojto 158:b23ee177fd68 1619 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1620 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1621 SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1622 }
Kojto 158:b23ee177fd68 1623
Kojto 158:b23ee177fd68 1624 /**
Kojto 158:b23ee177fd68 1625 * @brief Disable clearing the output channel on an external event.
Kojto 158:b23ee177fd68 1626 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
Kojto 158:b23ee177fd68 1627 * or not a timer instance can clear the OCxREF signal on an external event.
Kojto 158:b23ee177fd68 1628 * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n
Kojto 158:b23ee177fd68 1629 * CCMR1 OC2CE LL_TIM_OC_DisableClear\n
Kojto 158:b23ee177fd68 1630 * CCMR2 OC3CE LL_TIM_OC_DisableClear\n
Kojto 158:b23ee177fd68 1631 * CCMR2 OC4CE LL_TIM_OC_DisableClear
Kojto 158:b23ee177fd68 1632 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1633 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1634 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1635 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1636 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1637 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1638 * @retval None
Kojto 158:b23ee177fd68 1639 */
Anna Bridge 186:707f6e361f3e 1640 __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1641 {
Kojto 158:b23ee177fd68 1642 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1643 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1644 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
Kojto 158:b23ee177fd68 1645 }
Kojto 158:b23ee177fd68 1646
Kojto 158:b23ee177fd68 1647 /**
Kojto 158:b23ee177fd68 1648 * @brief Indicates clearing the output channel on an external event is enabled for the output channel.
Kojto 158:b23ee177fd68 1649 * @note This function enables clearing the output channel on an external event.
Kojto 158:b23ee177fd68 1650 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
Kojto 158:b23ee177fd68 1651 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
Kojto 158:b23ee177fd68 1652 * or not a timer instance can clear the OCxREF signal on an external event.
Kojto 158:b23ee177fd68 1653 * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n
Kojto 158:b23ee177fd68 1654 * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n
Kojto 158:b23ee177fd68 1655 * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n
Kojto 158:b23ee177fd68 1656 * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n
Kojto 158:b23ee177fd68 1657 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1658 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1659 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1660 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1661 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1662 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1663 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1664 */
Anna Bridge 186:707f6e361f3e 1665 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1666 {
Kojto 158:b23ee177fd68 1667 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1668 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1669 register uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel];
Kojto 158:b23ee177fd68 1670 return (READ_BIT(*pReg, bitfield) == bitfield);
Kojto 158:b23ee177fd68 1671 }
Kojto 158:b23ee177fd68 1672
Kojto 158:b23ee177fd68 1673 /**
Kojto 158:b23ee177fd68 1674 * @brief Set compare value for output channel 1 (TIMx_CCR1).
Kojto 158:b23ee177fd68 1675 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1676 * output channel 1 is supported by a timer instance.
Kojto 158:b23ee177fd68 1677 * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1
Kojto 158:b23ee177fd68 1678 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1679 * @param CompareValue between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1680 * @retval None
Kojto 158:b23ee177fd68 1681 */
Anna Bridge 186:707f6e361f3e 1682 __STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue)
Kojto 158:b23ee177fd68 1683 {
Kojto 158:b23ee177fd68 1684 WRITE_REG(TIMx->CCR1, CompareValue);
Kojto 158:b23ee177fd68 1685 }
Kojto 158:b23ee177fd68 1686
Kojto 158:b23ee177fd68 1687 /**
Kojto 158:b23ee177fd68 1688 * @brief Set compare value for output channel 2 (TIMx_CCR2).
Kojto 158:b23ee177fd68 1689 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1690 * output channel 2 is supported by a timer instance.
Kojto 158:b23ee177fd68 1691 * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2
Kojto 158:b23ee177fd68 1692 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1693 * @param CompareValue between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1694 * @retval None
Kojto 158:b23ee177fd68 1695 */
Anna Bridge 186:707f6e361f3e 1696 __STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue)
Kojto 158:b23ee177fd68 1697 {
Kojto 158:b23ee177fd68 1698 WRITE_REG(TIMx->CCR2, CompareValue);
Kojto 158:b23ee177fd68 1699 }
Kojto 158:b23ee177fd68 1700
Kojto 158:b23ee177fd68 1701 /**
Kojto 158:b23ee177fd68 1702 * @brief Set compare value for output channel 3 (TIMx_CCR3).
Kojto 158:b23ee177fd68 1703 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1704 * output channel is supported by a timer instance.
Kojto 158:b23ee177fd68 1705 * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3
Kojto 158:b23ee177fd68 1706 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1707 * @param CompareValue between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1708 * @retval None
Kojto 158:b23ee177fd68 1709 */
Anna Bridge 186:707f6e361f3e 1710 __STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue)
Kojto 158:b23ee177fd68 1711 {
Kojto 158:b23ee177fd68 1712 WRITE_REG(TIMx->CCR3, CompareValue);
Kojto 158:b23ee177fd68 1713 }
Kojto 158:b23ee177fd68 1714
Kojto 158:b23ee177fd68 1715 /**
Kojto 158:b23ee177fd68 1716 * @brief Set compare value for output channel 4 (TIMx_CCR4).
Kojto 158:b23ee177fd68 1717 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1718 * output channel 4 is supported by a timer instance.
Kojto 158:b23ee177fd68 1719 * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4
Kojto 158:b23ee177fd68 1720 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1721 * @param CompareValue between Min_Data=0 and Max_Data=65535
Kojto 158:b23ee177fd68 1722 * @retval None
Kojto 158:b23ee177fd68 1723 */
Anna Bridge 186:707f6e361f3e 1724 __STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue)
Kojto 158:b23ee177fd68 1725 {
Kojto 158:b23ee177fd68 1726 WRITE_REG(TIMx->CCR4, CompareValue);
Kojto 158:b23ee177fd68 1727 }
Kojto 158:b23ee177fd68 1728
Kojto 158:b23ee177fd68 1729 /**
Kojto 158:b23ee177fd68 1730 * @brief Get compare value (TIMx_CCR1) set for output channel 1.
Kojto 158:b23ee177fd68 1731 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1732 * output channel 1 is supported by a timer instance.
Kojto 158:b23ee177fd68 1733 * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1
Kojto 158:b23ee177fd68 1734 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1735 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 1736 */
Anna Bridge 186:707f6e361f3e 1737 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1738 {
Kojto 158:b23ee177fd68 1739 return (uint32_t)(READ_REG(TIMx->CCR1));
Kojto 158:b23ee177fd68 1740 }
Kojto 158:b23ee177fd68 1741
Kojto 158:b23ee177fd68 1742 /**
Kojto 158:b23ee177fd68 1743 * @brief Get compare value (TIMx_CCR2) set for output channel 2.
Kojto 158:b23ee177fd68 1744 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1745 * output channel 2 is supported by a timer instance.
Kojto 158:b23ee177fd68 1746 * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2
Kojto 158:b23ee177fd68 1747 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1748 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 1749 */
Anna Bridge 186:707f6e361f3e 1750 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1751 {
Kojto 158:b23ee177fd68 1752 return (uint32_t)(READ_REG(TIMx->CCR2));
Kojto 158:b23ee177fd68 1753 }
Kojto 158:b23ee177fd68 1754
Kojto 158:b23ee177fd68 1755 /**
Kojto 158:b23ee177fd68 1756 * @brief Get compare value (TIMx_CCR3) set for output channel 3.
Kojto 158:b23ee177fd68 1757 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1758 * output channel 3 is supported by a timer instance.
Kojto 158:b23ee177fd68 1759 * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3
Kojto 158:b23ee177fd68 1760 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1761 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 1762 */
Anna Bridge 186:707f6e361f3e 1763 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1764 {
Kojto 158:b23ee177fd68 1765 return (uint32_t)(READ_REG(TIMx->CCR3));
Kojto 158:b23ee177fd68 1766 }
Kojto 158:b23ee177fd68 1767
Kojto 158:b23ee177fd68 1768 /**
Kojto 158:b23ee177fd68 1769 * @brief Get compare value (TIMx_CCR4) set for output channel 4.
Kojto 158:b23ee177fd68 1770 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 1771 * output channel 4 is supported by a timer instance.
Kojto 158:b23ee177fd68 1772 * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4
Kojto 158:b23ee177fd68 1773 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1774 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 1775 */
Anna Bridge 186:707f6e361f3e 1776 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 1777 {
Kojto 158:b23ee177fd68 1778 return (uint32_t)(READ_REG(TIMx->CCR4));
Kojto 158:b23ee177fd68 1779 }
Kojto 158:b23ee177fd68 1780
Kojto 158:b23ee177fd68 1781 /**
Kojto 158:b23ee177fd68 1782 * @}
Kojto 158:b23ee177fd68 1783 */
Kojto 158:b23ee177fd68 1784
Kojto 158:b23ee177fd68 1785 /** @defgroup TIM_LL_EF_Input_Channel Input channel configuration
Kojto 158:b23ee177fd68 1786 * @{
Kojto 158:b23ee177fd68 1787 */
Kojto 158:b23ee177fd68 1788 /**
Kojto 158:b23ee177fd68 1789 * @brief Configure input channel.
Kojto 158:b23ee177fd68 1790 * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1791 * CCMR1 IC1PSC LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1792 * CCMR1 IC1F LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1793 * CCMR1 CC2S LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1794 * CCMR1 IC2PSC LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1795 * CCMR1 IC2F LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1796 * CCMR2 CC3S LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1797 * CCMR2 IC3PSC LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1798 * CCMR2 IC3F LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1799 * CCMR2 CC4S LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1800 * CCMR2 IC4PSC LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1801 * CCMR2 IC4F LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1802 * CCER CC1P LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1803 * CCER CC1NP LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1804 * CCER CC2P LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1805 * CCER CC2NP LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1806 * CCER CC3P LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1807 * CCER CC3NP LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1808 * CCER CC4P LL_TIM_IC_Config\n
Kojto 158:b23ee177fd68 1809 * CCER CC4NP LL_TIM_IC_Config
Kojto 158:b23ee177fd68 1810 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1811 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1812 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1813 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1814 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1815 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1816 * @param Configuration This parameter must be a combination of all the following values:
Kojto 158:b23ee177fd68 1817 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC
Kojto 158:b23ee177fd68 1818 * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8
Kojto 158:b23ee177fd68 1819 * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8
Kojto 158:b23ee177fd68 1820 * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING or @ref LL_TIM_IC_POLARITY_BOTHEDGE
Kojto 158:b23ee177fd68 1821 * @retval None
Kojto 158:b23ee177fd68 1822 */
Anna Bridge 186:707f6e361f3e 1823 __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
Kojto 158:b23ee177fd68 1824 {
Kojto 158:b23ee177fd68 1825 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1826 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Anna Bridge 186:707f6e361f3e 1827 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]),
Anna Bridge 186:707f6e361f3e 1828 ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]);
Anna Bridge 186:707f6e361f3e 1829 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
Anna Bridge 186:707f6e361f3e 1830 (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 1831 }
Kojto 158:b23ee177fd68 1832
Kojto 158:b23ee177fd68 1833 /**
Kojto 158:b23ee177fd68 1834 * @brief Set the active input.
Kojto 158:b23ee177fd68 1835 * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n
Kojto 158:b23ee177fd68 1836 * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n
Kojto 158:b23ee177fd68 1837 * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n
Kojto 158:b23ee177fd68 1838 * CCMR2 CC4S LL_TIM_IC_SetActiveInput
Kojto 158:b23ee177fd68 1839 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1840 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1841 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1842 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1843 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1844 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1845 * @param ICActiveInput This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1846 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
Kojto 158:b23ee177fd68 1847 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
Kojto 158:b23ee177fd68 1848 * @arg @ref LL_TIM_ACTIVEINPUT_TRC
Kojto 158:b23ee177fd68 1849 * @retval None
Kojto 158:b23ee177fd68 1850 */
Anna Bridge 186:707f6e361f3e 1851 __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput)
Kojto 158:b23ee177fd68 1852 {
Kojto 158:b23ee177fd68 1853 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1854 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Anna Bridge 186:707f6e361f3e 1855 MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]);
Kojto 158:b23ee177fd68 1856 }
Kojto 158:b23ee177fd68 1857
Kojto 158:b23ee177fd68 1858 /**
Kojto 158:b23ee177fd68 1859 * @brief Get the current active input.
Kojto 158:b23ee177fd68 1860 * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n
Kojto 158:b23ee177fd68 1861 * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n
Kojto 158:b23ee177fd68 1862 * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n
Kojto 158:b23ee177fd68 1863 * CCMR2 CC4S LL_TIM_IC_GetActiveInput
Kojto 158:b23ee177fd68 1864 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1865 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1866 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1867 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1868 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1869 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1870 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1871 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
Kojto 158:b23ee177fd68 1872 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
Kojto 158:b23ee177fd68 1873 * @arg @ref LL_TIM_ACTIVEINPUT_TRC
Kojto 158:b23ee177fd68 1874 */
Anna Bridge 186:707f6e361f3e 1875 __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1876 {
Kojto 158:b23ee177fd68 1877 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1878 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1879 return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
Kojto 158:b23ee177fd68 1880 }
Kojto 158:b23ee177fd68 1881
Kojto 158:b23ee177fd68 1882 /**
Kojto 158:b23ee177fd68 1883 * @brief Set the prescaler of input channel.
Kojto 158:b23ee177fd68 1884 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n
Kojto 158:b23ee177fd68 1885 * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n
Kojto 158:b23ee177fd68 1886 * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n
Kojto 158:b23ee177fd68 1887 * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler
Kojto 158:b23ee177fd68 1888 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1889 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1890 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1891 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1892 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1893 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1894 * @param ICPrescaler This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1895 * @arg @ref LL_TIM_ICPSC_DIV1
Kojto 158:b23ee177fd68 1896 * @arg @ref LL_TIM_ICPSC_DIV2
Kojto 158:b23ee177fd68 1897 * @arg @ref LL_TIM_ICPSC_DIV4
Kojto 158:b23ee177fd68 1898 * @arg @ref LL_TIM_ICPSC_DIV8
Kojto 158:b23ee177fd68 1899 * @retval None
Kojto 158:b23ee177fd68 1900 */
Anna Bridge 186:707f6e361f3e 1901 __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler)
Kojto 158:b23ee177fd68 1902 {
Kojto 158:b23ee177fd68 1903 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1904 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Anna Bridge 186:707f6e361f3e 1905 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]);
Kojto 158:b23ee177fd68 1906 }
Kojto 158:b23ee177fd68 1907
Kojto 158:b23ee177fd68 1908 /**
Kojto 158:b23ee177fd68 1909 * @brief Get the current prescaler value acting on an input channel.
Kojto 158:b23ee177fd68 1910 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n
Kojto 158:b23ee177fd68 1911 * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n
Kojto 158:b23ee177fd68 1912 * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n
Kojto 158:b23ee177fd68 1913 * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler
Kojto 158:b23ee177fd68 1914 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1915 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1916 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1917 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1918 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1919 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1920 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1921 * @arg @ref LL_TIM_ICPSC_DIV1
Kojto 158:b23ee177fd68 1922 * @arg @ref LL_TIM_ICPSC_DIV2
Kojto 158:b23ee177fd68 1923 * @arg @ref LL_TIM_ICPSC_DIV4
Kojto 158:b23ee177fd68 1924 * @arg @ref LL_TIM_ICPSC_DIV8
Kojto 158:b23ee177fd68 1925 */
Anna Bridge 186:707f6e361f3e 1926 __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 1927 {
Kojto 158:b23ee177fd68 1928 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1929 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Kojto 158:b23ee177fd68 1930 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
Kojto 158:b23ee177fd68 1931 }
Kojto 158:b23ee177fd68 1932
Kojto 158:b23ee177fd68 1933 /**
Kojto 158:b23ee177fd68 1934 * @brief Set the input filter duration.
Kojto 158:b23ee177fd68 1935 * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n
Kojto 158:b23ee177fd68 1936 * CCMR1 IC2F LL_TIM_IC_SetFilter\n
Kojto 158:b23ee177fd68 1937 * CCMR2 IC3F LL_TIM_IC_SetFilter\n
Kojto 158:b23ee177fd68 1938 * CCMR2 IC4F LL_TIM_IC_SetFilter
Kojto 158:b23ee177fd68 1939 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1940 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1941 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1942 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1943 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1944 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1945 * @param ICFilter This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1946 * @arg @ref LL_TIM_IC_FILTER_FDIV1
Kojto 158:b23ee177fd68 1947 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
Kojto 158:b23ee177fd68 1948 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
Kojto 158:b23ee177fd68 1949 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
Kojto 158:b23ee177fd68 1950 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
Kojto 158:b23ee177fd68 1951 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
Kojto 158:b23ee177fd68 1952 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
Kojto 158:b23ee177fd68 1953 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
Kojto 158:b23ee177fd68 1954 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
Kojto 158:b23ee177fd68 1955 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
Kojto 158:b23ee177fd68 1956 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
Kojto 158:b23ee177fd68 1957 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
Kojto 158:b23ee177fd68 1958 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
Kojto 158:b23ee177fd68 1959 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
Kojto 158:b23ee177fd68 1960 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
Kojto 158:b23ee177fd68 1961 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
Kojto 158:b23ee177fd68 1962 * @retval None
Kojto 158:b23ee177fd68 1963 */
Anna Bridge 186:707f6e361f3e 1964 __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter)
Kojto 158:b23ee177fd68 1965 {
Kojto 158:b23ee177fd68 1966 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 1967 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Anna Bridge 186:707f6e361f3e 1968 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]);
Kojto 158:b23ee177fd68 1969 }
Kojto 158:b23ee177fd68 1970
Kojto 158:b23ee177fd68 1971 /**
Kojto 158:b23ee177fd68 1972 * @brief Get the input filter duration.
Kojto 158:b23ee177fd68 1973 * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n
Kojto 158:b23ee177fd68 1974 * CCMR1 IC2F LL_TIM_IC_GetFilter\n
Kojto 158:b23ee177fd68 1975 * CCMR2 IC3F LL_TIM_IC_GetFilter\n
Kojto 158:b23ee177fd68 1976 * CCMR2 IC4F LL_TIM_IC_GetFilter
Kojto 158:b23ee177fd68 1977 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 1978 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1979 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 1980 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 1981 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 1982 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 1983 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1984 * @arg @ref LL_TIM_IC_FILTER_FDIV1
Kojto 158:b23ee177fd68 1985 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
Kojto 158:b23ee177fd68 1986 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
Kojto 158:b23ee177fd68 1987 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
Kojto 158:b23ee177fd68 1988 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
Kojto 158:b23ee177fd68 1989 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
Kojto 158:b23ee177fd68 1990 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
Kojto 158:b23ee177fd68 1991 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
Kojto 158:b23ee177fd68 1992 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
Kojto 158:b23ee177fd68 1993 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
Kojto 158:b23ee177fd68 1994 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
Kojto 158:b23ee177fd68 1995 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
Kojto 158:b23ee177fd68 1996 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
Kojto 158:b23ee177fd68 1997 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
Kojto 158:b23ee177fd68 1998 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
Kojto 158:b23ee177fd68 1999 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
Kojto 158:b23ee177fd68 2000 */
Anna Bridge 186:707f6e361f3e 2001 __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 2002 {
Kojto 158:b23ee177fd68 2003 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 2004 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
Anna Bridge 186:707f6e361f3e 2005 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
Kojto 158:b23ee177fd68 2006 }
Kojto 158:b23ee177fd68 2007
Kojto 158:b23ee177fd68 2008 /**
Kojto 158:b23ee177fd68 2009 * @brief Set the input channel polarity.
Kojto 158:b23ee177fd68 2010 * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2011 * CCER CC1NP LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2012 * CCER CC2P LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2013 * CCER CC2NP LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2014 * CCER CC3P LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2015 * CCER CC3NP LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2016 * CCER CC4P LL_TIM_IC_SetPolarity\n
Kojto 158:b23ee177fd68 2017 * CCER CC4NP LL_TIM_IC_SetPolarity
Kojto 158:b23ee177fd68 2018 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2019 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2020 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 2021 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 2022 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 2023 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 2024 * @param ICPolarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2025 * @arg @ref LL_TIM_IC_POLARITY_RISING
Kojto 158:b23ee177fd68 2026 * @arg @ref LL_TIM_IC_POLARITY_FALLING
Kojto 158:b23ee177fd68 2027 * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE
Kojto 158:b23ee177fd68 2028 * @retval None
Kojto 158:b23ee177fd68 2029 */
Anna Bridge 186:707f6e361f3e 2030 __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity)
Kojto 158:b23ee177fd68 2031 {
Kojto 158:b23ee177fd68 2032 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 2033 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
Anna Bridge 186:707f6e361f3e 2034 ICPolarity << SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 2035 }
Kojto 158:b23ee177fd68 2036
Kojto 158:b23ee177fd68 2037 /**
Kojto 158:b23ee177fd68 2038 * @brief Get the current input channel polarity.
Kojto 158:b23ee177fd68 2039 * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2040 * CCER CC1NP LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2041 * CCER CC2P LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2042 * CCER CC2NP LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2043 * CCER CC3P LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2044 * CCER CC3NP LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2045 * CCER CC4P LL_TIM_IC_GetPolarity\n
Kojto 158:b23ee177fd68 2046 * CCER CC4NP LL_TIM_IC_GetPolarity
Kojto 158:b23ee177fd68 2047 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2048 * @param Channel This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2049 * @arg @ref LL_TIM_CHANNEL_CH1
Kojto 158:b23ee177fd68 2050 * @arg @ref LL_TIM_CHANNEL_CH2
Kojto 158:b23ee177fd68 2051 * @arg @ref LL_TIM_CHANNEL_CH3
Kojto 158:b23ee177fd68 2052 * @arg @ref LL_TIM_CHANNEL_CH4
Kojto 158:b23ee177fd68 2053 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 2054 * @arg @ref LL_TIM_IC_POLARITY_RISING
Kojto 158:b23ee177fd68 2055 * @arg @ref LL_TIM_IC_POLARITY_FALLING
Kojto 158:b23ee177fd68 2056 * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE
Kojto 158:b23ee177fd68 2057 */
Anna Bridge 186:707f6e361f3e 2058 __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel)
Kojto 158:b23ee177fd68 2059 {
Kojto 158:b23ee177fd68 2060 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
Anna Bridge 186:707f6e361f3e 2061 return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >>
Anna Bridge 186:707f6e361f3e 2062 SHIFT_TAB_CCxP[iChannel]);
Kojto 158:b23ee177fd68 2063 }
Kojto 158:b23ee177fd68 2064
Kojto 158:b23ee177fd68 2065 /**
Kojto 158:b23ee177fd68 2066 * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination).
Kojto 158:b23ee177fd68 2067 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2068 * a timer instance provides an XOR input.
Kojto 158:b23ee177fd68 2069 * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination
Kojto 158:b23ee177fd68 2070 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2071 * @retval None
Kojto 158:b23ee177fd68 2072 */
Anna Bridge 186:707f6e361f3e 2073 __STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2074 {
Kojto 158:b23ee177fd68 2075 SET_BIT(TIMx->CR2, TIM_CR2_TI1S);
Kojto 158:b23ee177fd68 2076 }
Kojto 158:b23ee177fd68 2077
Kojto 158:b23ee177fd68 2078 /**
Kojto 158:b23ee177fd68 2079 * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input.
Kojto 158:b23ee177fd68 2080 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2081 * a timer instance provides an XOR input.
Kojto 158:b23ee177fd68 2082 * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination
Kojto 158:b23ee177fd68 2083 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2084 * @retval None
Kojto 158:b23ee177fd68 2085 */
Anna Bridge 186:707f6e361f3e 2086 __STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2087 {
Kojto 158:b23ee177fd68 2088 CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S);
Kojto 158:b23ee177fd68 2089 }
Kojto 158:b23ee177fd68 2090
Kojto 158:b23ee177fd68 2091 /**
Kojto 158:b23ee177fd68 2092 * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input.
Kojto 158:b23ee177fd68 2093 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2094 * a timer instance provides an XOR input.
Kojto 158:b23ee177fd68 2095 * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination
Kojto 158:b23ee177fd68 2096 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2097 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2098 */
Anna Bridge 186:707f6e361f3e 2099 __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2100 {
Kojto 158:b23ee177fd68 2101 return (READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S));
Kojto 158:b23ee177fd68 2102 }
Kojto 158:b23ee177fd68 2103
Kojto 158:b23ee177fd68 2104 /**
Kojto 158:b23ee177fd68 2105 * @brief Get captured value for input channel 1.
Kojto 158:b23ee177fd68 2106 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2107 * input channel 1 is supported by a timer instance.
Kojto 158:b23ee177fd68 2108 * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1
Kojto 158:b23ee177fd68 2109 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2110 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 2111 */
Anna Bridge 186:707f6e361f3e 2112 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2113 {
Kojto 158:b23ee177fd68 2114 return (uint32_t)(READ_REG(TIMx->CCR1));
Kojto 158:b23ee177fd68 2115 }
Kojto 158:b23ee177fd68 2116
Kojto 158:b23ee177fd68 2117 /**
Kojto 158:b23ee177fd68 2118 * @brief Get captured value for input channel 2.
Kojto 158:b23ee177fd68 2119 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2120 * input channel 2 is supported by a timer instance.
Kojto 158:b23ee177fd68 2121 * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2
Kojto 158:b23ee177fd68 2122 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2123 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 2124 */
Anna Bridge 186:707f6e361f3e 2125 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2126 {
Kojto 158:b23ee177fd68 2127 return (uint32_t)(READ_REG(TIMx->CCR2));
Kojto 158:b23ee177fd68 2128 }
Kojto 158:b23ee177fd68 2129
Kojto 158:b23ee177fd68 2130 /**
Kojto 158:b23ee177fd68 2131 * @brief Get captured value for input channel 3.
Kojto 158:b23ee177fd68 2132 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2133 * input channel 3 is supported by a timer instance.
Kojto 158:b23ee177fd68 2134 * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3
Kojto 158:b23ee177fd68 2135 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2136 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 2137 */
Anna Bridge 186:707f6e361f3e 2138 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2139 {
Kojto 158:b23ee177fd68 2140 return (uint32_t)(READ_REG(TIMx->CCR3));
Kojto 158:b23ee177fd68 2141 }
Kojto 158:b23ee177fd68 2142
Kojto 158:b23ee177fd68 2143 /**
Kojto 158:b23ee177fd68 2144 * @brief Get captured value for input channel 4.
Kojto 158:b23ee177fd68 2145 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2146 * input channel 4 is supported by a timer instance.
Kojto 158:b23ee177fd68 2147 * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4
Kojto 158:b23ee177fd68 2148 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2149 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
Kojto 158:b23ee177fd68 2150 */
Anna Bridge 186:707f6e361f3e 2151 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2152 {
Kojto 158:b23ee177fd68 2153 return (uint32_t)(READ_REG(TIMx->CCR4));
Kojto 158:b23ee177fd68 2154 }
Kojto 158:b23ee177fd68 2155
Kojto 158:b23ee177fd68 2156 /**
Kojto 158:b23ee177fd68 2157 * @}
Kojto 158:b23ee177fd68 2158 */
Kojto 158:b23ee177fd68 2159
Kojto 158:b23ee177fd68 2160 /** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection
Kojto 158:b23ee177fd68 2161 * @{
Kojto 158:b23ee177fd68 2162 */
Kojto 158:b23ee177fd68 2163 /**
Kojto 158:b23ee177fd68 2164 * @brief Enable external clock mode 2.
Kojto 158:b23ee177fd68 2165 * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal.
Anna Bridge 186:707f6e361f3e 2166 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2167 * whether or not a timer instance supports external clock mode2.
Kojto 158:b23ee177fd68 2168 * @rmtoll SMCR ECE LL_TIM_EnableExternalClock
Kojto 158:b23ee177fd68 2169 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2170 * @retval None
Kojto 158:b23ee177fd68 2171 */
Anna Bridge 186:707f6e361f3e 2172 __STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2173 {
Kojto 158:b23ee177fd68 2174 SET_BIT(TIMx->SMCR, TIM_SMCR_ECE);
Kojto 158:b23ee177fd68 2175 }
Kojto 158:b23ee177fd68 2176
Kojto 158:b23ee177fd68 2177 /**
Kojto 158:b23ee177fd68 2178 * @brief Disable external clock mode 2.
Anna Bridge 186:707f6e361f3e 2179 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2180 * whether or not a timer instance supports external clock mode2.
Kojto 158:b23ee177fd68 2181 * @rmtoll SMCR ECE LL_TIM_DisableExternalClock
Kojto 158:b23ee177fd68 2182 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2183 * @retval None
Kojto 158:b23ee177fd68 2184 */
Anna Bridge 186:707f6e361f3e 2185 __STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2186 {
Kojto 158:b23ee177fd68 2187 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE);
Kojto 158:b23ee177fd68 2188 }
Kojto 158:b23ee177fd68 2189
Kojto 158:b23ee177fd68 2190 /**
Kojto 158:b23ee177fd68 2191 * @brief Indicate whether external clock mode 2 is enabled.
Anna Bridge 186:707f6e361f3e 2192 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2193 * whether or not a timer instance supports external clock mode2.
Kojto 158:b23ee177fd68 2194 * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock
Kojto 158:b23ee177fd68 2195 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2196 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2197 */
Anna Bridge 186:707f6e361f3e 2198 __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2199 {
Kojto 158:b23ee177fd68 2200 return (READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE));
Kojto 158:b23ee177fd68 2201 }
Kojto 158:b23ee177fd68 2202
Kojto 158:b23ee177fd68 2203 /**
Kojto 158:b23ee177fd68 2204 * @brief Set the clock source of the counter clock.
Anna Bridge 186:707f6e361f3e 2205 * @note when selected clock source is external clock mode 1, the timer input
Anna Bridge 186:707f6e361f3e 2206 * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput()
Anna Bridge 186:707f6e361f3e 2207 * function. This timer input must be configured by calling
Kojto 158:b23ee177fd68 2208 * the @ref LL_TIM_IC_Config() function.
Anna Bridge 186:707f6e361f3e 2209 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2210 * whether or not a timer instance supports external clock mode1.
Anna Bridge 186:707f6e361f3e 2211 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2212 * whether or not a timer instance supports external clock mode2.
Kojto 158:b23ee177fd68 2213 * @rmtoll SMCR SMS LL_TIM_SetClockSource\n
Kojto 158:b23ee177fd68 2214 * SMCR ECE LL_TIM_SetClockSource
Kojto 158:b23ee177fd68 2215 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2216 * @param ClockSource This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2217 * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL
Kojto 158:b23ee177fd68 2218 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1
Kojto 158:b23ee177fd68 2219 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2
Kojto 158:b23ee177fd68 2220 * @retval None
Kojto 158:b23ee177fd68 2221 */
Anna Bridge 186:707f6e361f3e 2222 __STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource)
Kojto 158:b23ee177fd68 2223 {
Kojto 158:b23ee177fd68 2224 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource);
Kojto 158:b23ee177fd68 2225 }
Kojto 158:b23ee177fd68 2226
Kojto 158:b23ee177fd68 2227 /**
Kojto 158:b23ee177fd68 2228 * @brief Set the encoder interface mode.
Anna Bridge 186:707f6e361f3e 2229 * @note Macro @ref IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2230 * whether or not a timer instance supports the encoder mode.
Kojto 158:b23ee177fd68 2231 * @rmtoll SMCR SMS LL_TIM_SetEncoderMode
Kojto 158:b23ee177fd68 2232 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2233 * @param EncoderMode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2234 * @arg @ref LL_TIM_ENCODERMODE_X2_TI1
Kojto 158:b23ee177fd68 2235 * @arg @ref LL_TIM_ENCODERMODE_X2_TI2
Kojto 158:b23ee177fd68 2236 * @arg @ref LL_TIM_ENCODERMODE_X4_TI12
Kojto 158:b23ee177fd68 2237 * @retval None
Kojto 158:b23ee177fd68 2238 */
Anna Bridge 186:707f6e361f3e 2239 __STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode)
Kojto 158:b23ee177fd68 2240 {
Kojto 158:b23ee177fd68 2241 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode);
Kojto 158:b23ee177fd68 2242 }
Kojto 158:b23ee177fd68 2243
Kojto 158:b23ee177fd68 2244 /**
Kojto 158:b23ee177fd68 2245 * @}
Kojto 158:b23ee177fd68 2246 */
Kojto 158:b23ee177fd68 2247
Kojto 158:b23ee177fd68 2248 /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration
Kojto 158:b23ee177fd68 2249 * @{
Kojto 158:b23ee177fd68 2250 */
Kojto 158:b23ee177fd68 2251 /**
Kojto 158:b23ee177fd68 2252 * @brief Set the trigger output (TRGO) used for timer synchronization .
Anna Bridge 186:707f6e361f3e 2253 * @note Macro @ref IS_TIM_MASTER_INSTANCE(TIMx) can be used to check
Kojto 158:b23ee177fd68 2254 * whether or not a timer instance can operate as a master timer.
Kojto 158:b23ee177fd68 2255 * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput
Kojto 158:b23ee177fd68 2256 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2257 * @param TimerSynchronization This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2258 * @arg @ref LL_TIM_TRGO_RESET
Kojto 158:b23ee177fd68 2259 * @arg @ref LL_TIM_TRGO_ENABLE
Kojto 158:b23ee177fd68 2260 * @arg @ref LL_TIM_TRGO_UPDATE
Kojto 158:b23ee177fd68 2261 * @arg @ref LL_TIM_TRGO_CC1IF
Kojto 158:b23ee177fd68 2262 * @arg @ref LL_TIM_TRGO_OC1REF
Kojto 158:b23ee177fd68 2263 * @arg @ref LL_TIM_TRGO_OC2REF
Kojto 158:b23ee177fd68 2264 * @arg @ref LL_TIM_TRGO_OC3REF
Kojto 158:b23ee177fd68 2265 * @arg @ref LL_TIM_TRGO_OC4REF
Kojto 158:b23ee177fd68 2266 * @retval None
Kojto 158:b23ee177fd68 2267 */
Anna Bridge 186:707f6e361f3e 2268 __STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization)
Kojto 158:b23ee177fd68 2269 {
Kojto 158:b23ee177fd68 2270 MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization);
Kojto 158:b23ee177fd68 2271 }
Kojto 158:b23ee177fd68 2272
Kojto 158:b23ee177fd68 2273 /**
Kojto 158:b23ee177fd68 2274 * @brief Set the synchronization mode of a slave timer.
Anna Bridge 186:707f6e361f3e 2275 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2276 * a timer instance can operate as a slave timer.
Kojto 158:b23ee177fd68 2277 * @rmtoll SMCR SMS LL_TIM_SetSlaveMode
Kojto 158:b23ee177fd68 2278 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2279 * @param SlaveMode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2280 * @arg @ref LL_TIM_SLAVEMODE_DISABLED
Kojto 158:b23ee177fd68 2281 * @arg @ref LL_TIM_SLAVEMODE_RESET
Kojto 158:b23ee177fd68 2282 * @arg @ref LL_TIM_SLAVEMODE_GATED
Kojto 158:b23ee177fd68 2283 * @arg @ref LL_TIM_SLAVEMODE_TRIGGER
Kojto 158:b23ee177fd68 2284 * @retval None
Kojto 158:b23ee177fd68 2285 */
Anna Bridge 186:707f6e361f3e 2286 __STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode)
Kojto 158:b23ee177fd68 2287 {
Kojto 158:b23ee177fd68 2288 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode);
Kojto 158:b23ee177fd68 2289 }
Kojto 158:b23ee177fd68 2290
Kojto 158:b23ee177fd68 2291 /**
Kojto 158:b23ee177fd68 2292 * @brief Set the selects the trigger input to be used to synchronize the counter.
Anna Bridge 186:707f6e361f3e 2293 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2294 * a timer instance can operate as a slave timer.
Kojto 158:b23ee177fd68 2295 * @rmtoll SMCR TS LL_TIM_SetTriggerInput
Kojto 158:b23ee177fd68 2296 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2297 * @param TriggerInput This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2298 * @arg @ref LL_TIM_TS_ITR0
Kojto 158:b23ee177fd68 2299 * @arg @ref LL_TIM_TS_ITR1
Kojto 158:b23ee177fd68 2300 * @arg @ref LL_TIM_TS_ITR2
Kojto 158:b23ee177fd68 2301 * @arg @ref LL_TIM_TS_ITR3
Kojto 158:b23ee177fd68 2302 * @arg @ref LL_TIM_TS_TI1F_ED
Kojto 158:b23ee177fd68 2303 * @arg @ref LL_TIM_TS_TI1FP1
Kojto 158:b23ee177fd68 2304 * @arg @ref LL_TIM_TS_TI2FP2
Kojto 158:b23ee177fd68 2305 * @arg @ref LL_TIM_TS_ETRF
Kojto 158:b23ee177fd68 2306 * @retval None
Kojto 158:b23ee177fd68 2307 */
Anna Bridge 186:707f6e361f3e 2308 __STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput)
Kojto 158:b23ee177fd68 2309 {
Kojto 158:b23ee177fd68 2310 MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput);
Kojto 158:b23ee177fd68 2311 }
Kojto 158:b23ee177fd68 2312
Kojto 158:b23ee177fd68 2313 /**
Kojto 158:b23ee177fd68 2314 * @brief Enable the Master/Slave mode.
Anna Bridge 186:707f6e361f3e 2315 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2316 * a timer instance can operate as a slave timer.
Kojto 158:b23ee177fd68 2317 * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode
Kojto 158:b23ee177fd68 2318 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2319 * @retval None
Kojto 158:b23ee177fd68 2320 */
Anna Bridge 186:707f6e361f3e 2321 __STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2322 {
Kojto 158:b23ee177fd68 2323 SET_BIT(TIMx->SMCR, TIM_SMCR_MSM);
Kojto 158:b23ee177fd68 2324 }
Kojto 158:b23ee177fd68 2325
Kojto 158:b23ee177fd68 2326 /**
Kojto 158:b23ee177fd68 2327 * @brief Disable the Master/Slave mode.
Anna Bridge 186:707f6e361f3e 2328 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2329 * a timer instance can operate as a slave timer.
Kojto 158:b23ee177fd68 2330 * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode
Kojto 158:b23ee177fd68 2331 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2332 * @retval None
Kojto 158:b23ee177fd68 2333 */
Anna Bridge 186:707f6e361f3e 2334 __STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2335 {
Kojto 158:b23ee177fd68 2336 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM);
Kojto 158:b23ee177fd68 2337 }
Kojto 158:b23ee177fd68 2338
Kojto 158:b23ee177fd68 2339 /**
Kojto 158:b23ee177fd68 2340 * @brief Indicates whether the Master/Slave mode is enabled.
Anna Bridge 186:707f6e361f3e 2341 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2342 * a timer instance can operate as a slave timer.
Kojto 158:b23ee177fd68 2343 * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode
Kojto 158:b23ee177fd68 2344 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2345 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2346 */
Anna Bridge 186:707f6e361f3e 2347 __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2348 {
Kojto 158:b23ee177fd68 2349 return (READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM));
Kojto 158:b23ee177fd68 2350 }
Kojto 158:b23ee177fd68 2351
Kojto 158:b23ee177fd68 2352 /**
Kojto 158:b23ee177fd68 2353 * @brief Configure the external trigger (ETR) input.
Anna Bridge 186:707f6e361f3e 2354 * @note Macro @ref IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2355 * a timer instance provides an external trigger input.
Kojto 158:b23ee177fd68 2356 * @rmtoll SMCR ETP LL_TIM_ConfigETR\n
Kojto 158:b23ee177fd68 2357 * SMCR ETPS LL_TIM_ConfigETR\n
Kojto 158:b23ee177fd68 2358 * SMCR ETF LL_TIM_ConfigETR
Kojto 158:b23ee177fd68 2359 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2360 * @param ETRPolarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2361 * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED
Kojto 158:b23ee177fd68 2362 * @arg @ref LL_TIM_ETR_POLARITY_INVERTED
Kojto 158:b23ee177fd68 2363 * @param ETRPrescaler This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2364 * @arg @ref LL_TIM_ETR_PRESCALER_DIV1
Kojto 158:b23ee177fd68 2365 * @arg @ref LL_TIM_ETR_PRESCALER_DIV2
Kojto 158:b23ee177fd68 2366 * @arg @ref LL_TIM_ETR_PRESCALER_DIV4
Kojto 158:b23ee177fd68 2367 * @arg @ref LL_TIM_ETR_PRESCALER_DIV8
Kojto 158:b23ee177fd68 2368 * @param ETRFilter This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2369 * @arg @ref LL_TIM_ETR_FILTER_FDIV1
Kojto 158:b23ee177fd68 2370 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2
Kojto 158:b23ee177fd68 2371 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4
Kojto 158:b23ee177fd68 2372 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8
Kojto 158:b23ee177fd68 2373 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6
Kojto 158:b23ee177fd68 2374 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8
Kojto 158:b23ee177fd68 2375 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6
Kojto 158:b23ee177fd68 2376 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8
Kojto 158:b23ee177fd68 2377 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6
Kojto 158:b23ee177fd68 2378 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8
Kojto 158:b23ee177fd68 2379 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5
Kojto 158:b23ee177fd68 2380 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6
Kojto 158:b23ee177fd68 2381 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8
Kojto 158:b23ee177fd68 2382 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5
Kojto 158:b23ee177fd68 2383 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6
Kojto 158:b23ee177fd68 2384 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8
Kojto 158:b23ee177fd68 2385 * @retval None
Kojto 158:b23ee177fd68 2386 */
Anna Bridge 186:707f6e361f3e 2387 __STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler,
Anna Bridge 186:707f6e361f3e 2388 uint32_t ETRFilter)
Kojto 158:b23ee177fd68 2389 {
Kojto 158:b23ee177fd68 2390 MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter);
Kojto 158:b23ee177fd68 2391 }
Kojto 158:b23ee177fd68 2392
Kojto 158:b23ee177fd68 2393 /**
Kojto 158:b23ee177fd68 2394 * @}
Kojto 158:b23ee177fd68 2395 */
Kojto 158:b23ee177fd68 2396
Kojto 158:b23ee177fd68 2397 /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration
Kojto 158:b23ee177fd68 2398 * @{
Kojto 158:b23ee177fd68 2399 */
Kojto 158:b23ee177fd68 2400 /**
Kojto 158:b23ee177fd68 2401 * @brief Configures the timer DMA burst feature.
Kojto 158:b23ee177fd68 2402 * @note Macro @ref IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or
Kojto 158:b23ee177fd68 2403 * not a timer instance supports the DMA burst mode.
Kojto 158:b23ee177fd68 2404 * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n
Kojto 158:b23ee177fd68 2405 * DCR DBA LL_TIM_ConfigDMABurst
Kojto 158:b23ee177fd68 2406 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2407 * @param DMABurstBaseAddress This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2408 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1
Kojto 158:b23ee177fd68 2409 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2
Kojto 158:b23ee177fd68 2410 * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR
Kojto 158:b23ee177fd68 2411 * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER
Kojto 158:b23ee177fd68 2412 * @arg @ref LL_TIM_DMABURST_BASEADDR_SR
Kojto 158:b23ee177fd68 2413 * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR
Kojto 158:b23ee177fd68 2414 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1
Kojto 158:b23ee177fd68 2415 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2
Kojto 158:b23ee177fd68 2416 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER
Kojto 158:b23ee177fd68 2417 * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT
Kojto 158:b23ee177fd68 2418 * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC
Kojto 158:b23ee177fd68 2419 * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR
Kojto 158:b23ee177fd68 2420 * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR
Kojto 158:b23ee177fd68 2421 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1
Kojto 158:b23ee177fd68 2422 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2
Kojto 158:b23ee177fd68 2423 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3
Kojto 158:b23ee177fd68 2424 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4
Kojto 158:b23ee177fd68 2425 * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR
Kojto 158:b23ee177fd68 2426 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR3
Kojto 158:b23ee177fd68 2427 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR5
Kojto 158:b23ee177fd68 2428 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR6
Kojto 158:b23ee177fd68 2429 * @arg @ref LL_TIM_DMABURST_BASEADDR_OR1
Kojto 158:b23ee177fd68 2430 * @arg @ref LL_TIM_DMABURST_BASEADDR_OR2
Kojto 158:b23ee177fd68 2431 * @arg @ref LL_TIM_DMABURST_BASEADDR_OR3
Kojto 158:b23ee177fd68 2432 * @param DMABurstLength This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2433 * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER
Kojto 158:b23ee177fd68 2434 * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS
Kojto 158:b23ee177fd68 2435 * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS
Kojto 158:b23ee177fd68 2436 * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS
Kojto 158:b23ee177fd68 2437 * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS
Kojto 158:b23ee177fd68 2438 * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS
Kojto 158:b23ee177fd68 2439 * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS
Kojto 158:b23ee177fd68 2440 * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS
Kojto 158:b23ee177fd68 2441 * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS
Kojto 158:b23ee177fd68 2442 * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS
Kojto 158:b23ee177fd68 2443 * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS
Kojto 158:b23ee177fd68 2444 * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS
Kojto 158:b23ee177fd68 2445 * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS
Kojto 158:b23ee177fd68 2446 * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS
Kojto 158:b23ee177fd68 2447 * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS
Kojto 158:b23ee177fd68 2448 * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS
Kojto 158:b23ee177fd68 2449 * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS
Kojto 158:b23ee177fd68 2450 * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS
Kojto 158:b23ee177fd68 2451 * @retval None
Kojto 158:b23ee177fd68 2452 */
Anna Bridge 186:707f6e361f3e 2453 __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength)
Kojto 158:b23ee177fd68 2454 {
Kojto 158:b23ee177fd68 2455 MODIFY_REG(TIMx->DCR, TIM_DCR_DBL | TIM_DCR_DBA, DMABurstBaseAddress | DMABurstLength);
Kojto 158:b23ee177fd68 2456 }
Kojto 158:b23ee177fd68 2457
Kojto 158:b23ee177fd68 2458 /**
Kojto 158:b23ee177fd68 2459 * @}
Kojto 158:b23ee177fd68 2460 */
Kojto 158:b23ee177fd68 2461
Kojto 158:b23ee177fd68 2462 /** @defgroup TIM_LL_EF_Timer_Inputs_Remapping Timer input remapping
Kojto 158:b23ee177fd68 2463 * @{
Kojto 158:b23ee177fd68 2464 */
Kojto 158:b23ee177fd68 2465 /**
Kojto 158:b23ee177fd68 2466 * @brief Remap TIM inputs (input channel, internal/external triggers).
Kojto 158:b23ee177fd68 2467 * @note Macro @ref IS_TIM_REMAP_INSTANCE(TIMx) can be used to check whether or not
Kojto 158:b23ee177fd68 2468 * a some timer inputs can be remapped.
Kojto 158:b23ee177fd68 2469 * @rmtoll TIM2_OR ETR_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2470 * TIM2_OR TI4_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2471 * TIM21_OR ETR_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2472 * TIM21_OR TI1_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2473 * TIM21_OR TI2_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2474 * TIM22_OR ETR_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2475 * TIM22_OR TI1_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2476 * TIM3_OR ETR_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2477 * TIM3_OR TI1_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2478 * TIM3_OR TI2_RMP LL_TIM_SetRemap\n
Kojto 158:b23ee177fd68 2479 * TIM3_OR TI4_RMP LL_TIM_SetRemap
Anna Bridge 186:707f6e361f3e 2480 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2481 * @param Remap Remap params depends on the TIMx. Description available only
Anna Bridge 186:707f6e361f3e 2482 * in CHM version of the User Manual (not in .pdf).
Kojto 158:b23ee177fd68 2483 * Otherwise see Reference Manual description of OR registers.
Kojto 158:b23ee177fd68 2484 *
Anna Bridge 186:707f6e361f3e 2485 * Below description summarizes "Timer Instance" and "Remap" param combinations:
Kojto 158:b23ee177fd68 2486 *
Kojto 158:b23ee177fd68 2487 * TIM2: any combination of ETR_RMP, TI4_RMP where
Kojto 158:b23ee177fd68 2488 *
Kojto 158:b23ee177fd68 2489 * . . ETR_RMP can be one of the following values
Kojto 158:b23ee177fd68 2490 * @arg @ref LL_TIM_TIM2_ETR_RMP_GPIO
Kojto 158:b23ee177fd68 2491 * @arg @ref LL_TIM_TIM2_ETR_RMP_HSI (*)
Kojto 158:b23ee177fd68 2492 * @arg @ref LL_TIM_TIM2_ETR_RMP_HSI48 (*)
Kojto 158:b23ee177fd68 2493 * @arg @ref LL_TIM_TIM2_ETR_RMP_LSE
Kojto 158:b23ee177fd68 2494 * @arg @ref LL_TIM_TIM2_ETR_RMP_COMP2
Kojto 158:b23ee177fd68 2495 * @arg @ref LL_TIM_TIM2_ETR_RMP_COMP1
Kojto 158:b23ee177fd68 2496 *
Kojto 158:b23ee177fd68 2497 * . . TI4_RMP can be one of the following values
Kojto 158:b23ee177fd68 2498 * @arg @ref LL_TIM_TIM2_TI4_RMP_GPIO
Kojto 158:b23ee177fd68 2499 * @arg @ref LL_TIM_TIM2_TI4_RMP_COMP1
Kojto 158:b23ee177fd68 2500 * @arg @ref LL_TIM_TIM2_TI4_RMP_COMP2
Kojto 158:b23ee177fd68 2501 *
Kojto 158:b23ee177fd68 2502 * TIM3: any combination of the following values (**)
Kojto 158:b23ee177fd68 2503 *
Kojto 158:b23ee177fd68 2504 * . . ETR_RMP can be one of the following values (**)
Kojto 158:b23ee177fd68 2505 * @arg @ref LL_TIM_TIM3_ETR_RMP_GPIO
Anna Bridge 186:707f6e361f3e 2506 * @arg @ref LL_TIM_TIM3_ETR_RMP_HSI48DIV6
Kojto 158:b23ee177fd68 2507 *
Kojto 158:b23ee177fd68 2508 * . . TI_RMP_TI1 can be one of the following values (**)
Kojto 158:b23ee177fd68 2509 * @arg @ref LL_TIM_TIM3_TI_RMP_TI1_USB_SOF
Anna Bridge 186:707f6e361f3e 2510 * @arg @ref LL_TIM_TIM3_TI_RMP_TI1_GPIO
Kojto 158:b23ee177fd68 2511 *
Kojto 158:b23ee177fd68 2512 * . . TI_RMP_TI2 can be one of the following values (**)
Kojto 158:b23ee177fd68 2513 * @arg @ref LL_TIM_TIM3_TI_RMP_TI2_GPIO_DEF
Anna Bridge 186:707f6e361f3e 2514 * @arg @ref LL_TIM_TIM3_TI_RMP_TI2_GPIOB5_AF4
Kojto 158:b23ee177fd68 2515 *
Kojto 158:b23ee177fd68 2516 * . . TI_RMP_TI4 can be one of the following values (**)
Kojto 158:b23ee177fd68 2517 * @arg @ref LL_TIM_TIM3_TI_RMP_TI4_GPIO_DEF
Anna Bridge 186:707f6e361f3e 2518 * @arg @ref LL_TIM_TIM3_TI_RMP_TI4_GPIOC9_AF2
Kojto 158:b23ee177fd68 2519 *
Kojto 158:b23ee177fd68 2520 * TIM21: any combination of ETR_RMP, TI1_RMP, TI2_RMP where
Anna Bridge 186:707f6e361f3e 2521 *
Kojto 158:b23ee177fd68 2522 * . . ETR_RMP can be one of the following values
Kojto 158:b23ee177fd68 2523 * @arg @ref LL_TIM_TIM21_ETR_RMP_GPIO
Kojto 158:b23ee177fd68 2524 * @arg @ref LL_TIM_TIM21_ETR_RMP_COMP2
Kojto 158:b23ee177fd68 2525 * @arg @ref LL_TIM_TIM21_ETR_RMP_COMP1
Kojto 158:b23ee177fd68 2526 * @arg @ref LL_TIM_TIM21_ETR_RMP_LSE
Kojto 158:b23ee177fd68 2527 *
Kojto 158:b23ee177fd68 2528 * . . TI1_RMP can be one of the following values
Kojto 158:b23ee177fd68 2529 * @arg @ref LL_TIM_TIM21_TI1_RMP_GPIO
Kojto 158:b23ee177fd68 2530 * @arg @ref LL_TIM_TIM21_TI1_RMP_RTC_WK
Kojto 158:b23ee177fd68 2531 * @arg @ref LL_TIM_TIM21_TI1_RMP_HSE_RTC
Kojto 158:b23ee177fd68 2532 * @arg @ref LL_TIM_TIM21_TI1_RMP_MSI
Kojto 158:b23ee177fd68 2533 * @arg @ref LL_TIM_TIM21_TI1_RMP_LSE
Kojto 158:b23ee177fd68 2534 * @arg @ref LL_TIM_TIM21_TI1_RMP_LSI
Kojto 158:b23ee177fd68 2535 * @arg @ref LL_TIM_TIM21_TI1_RMP_COMP1
Kojto 158:b23ee177fd68 2536 * @arg @ref LL_TIM_TIM21_TI1_RMP_MCO
Kojto 158:b23ee177fd68 2537 *
Kojto 158:b23ee177fd68 2538 * . . TI2_RMP can be one of the following values
Kojto 158:b23ee177fd68 2539 * @arg @ref LL_TIM_TIM21_TI2_RMP_GPIO
Kojto 158:b23ee177fd68 2540 * @arg @ref LL_TIM_TIM21_TI2_RMP_COMP2
Kojto 158:b23ee177fd68 2541 *
Kojto 158:b23ee177fd68 2542 * TIM22: any combination of ETR_RMP, TI1_RMP where (**)
Kojto 158:b23ee177fd68 2543 *
Kojto 158:b23ee177fd68 2544 * . . ETR_RMP can be one of the following values (**)
Anna Bridge 186:707f6e361f3e 2545 * @arg @ref LL_TIM_TIM22_ETR_RMP_GPIO
Anna Bridge 186:707f6e361f3e 2546 * @arg @ref LL_TIM_TIM22_ETR_RMP_COMP2
Anna Bridge 186:707f6e361f3e 2547 * @arg @ref LL_TIM_TIM22_ETR_RMP_COMP1
Anna Bridge 186:707f6e361f3e 2548 * @arg @ref LL_TIM_TIM22_ETR_RMP_LSE
Kojto 158:b23ee177fd68 2549 *
Kojto 158:b23ee177fd68 2550 * . . TI1_RMP can be one of the following values (**)
Anna Bridge 186:707f6e361f3e 2551 * @arg @ref LL_TIM_TIM22_TI1_RMP_GPIO1
Anna Bridge 186:707f6e361f3e 2552 * @arg @ref LL_TIM_TIM22_TI1_RMP_COMP2
Anna Bridge 186:707f6e361f3e 2553 * @arg @ref LL_TIM_TIM22_TI1_RMP_COMP1
Anna Bridge 186:707f6e361f3e 2554 * @arg @ref LL_TIM_TIM22_TI1_RMP_GPIO2
Kojto 158:b23ee177fd68 2555 *
Kojto 158:b23ee177fd68 2556 * (*) Value not defined in all devices. \n
Kojto 158:b23ee177fd68 2557 * (*) Register not available in all devices.
Kojto 158:b23ee177fd68 2558 * @retval None
Kojto 158:b23ee177fd68 2559 */
Anna Bridge 186:707f6e361f3e 2560 __STATIC_INLINE void LL_TIM_SetRemap(TIM_TypeDef *TIMx, uint32_t Remap)
Kojto 158:b23ee177fd68 2561 {
Kojto 158:b23ee177fd68 2562 MODIFY_REG(TIMx->OR, (Remap >> TIMx_OR_RMP_SHIFT), (Remap & TIMx_OR_RMP_MASK));
Kojto 158:b23ee177fd68 2563 }
Kojto 158:b23ee177fd68 2564
Kojto 158:b23ee177fd68 2565 /**
Kojto 158:b23ee177fd68 2566 * @}
Kojto 158:b23ee177fd68 2567 */
Kojto 158:b23ee177fd68 2568
Kojto 158:b23ee177fd68 2569 /** @defgroup TIM_LL_EF_OCREF_Clear OCREF_Clear_Management
Kojto 158:b23ee177fd68 2570 * @{
Kojto 158:b23ee177fd68 2571 */
Kojto 158:b23ee177fd68 2572 /**
Anna Bridge 186:707f6e361f3e 2573 * @brief Set the OCREF clear input source
Kojto 158:b23ee177fd68 2574 * @note The OCxREF signal of a given channel can be cleared when a high level is applied on the OCREF_CLR_INPUT
Kojto 158:b23ee177fd68 2575 * @note This function can only be used in Output compare and PWM modes.
Anna Bridge 186:707f6e361f3e 2576 * @rmtoll SMCR OCCS LL_TIM_SetOCRefClearInputSource
Kojto 158:b23ee177fd68 2577 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2578 * @param OCRefClearInputSource This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2579 * @arg @ref LL_TIM_OCREF_CLR_INT_NC
Kojto 158:b23ee177fd68 2580 * @arg @ref LL_TIM_OCREF_CLR_INT_ETR
Kojto 158:b23ee177fd68 2581 * @retval None
Kojto 158:b23ee177fd68 2582 */
Anna Bridge 186:707f6e361f3e 2583 __STATIC_INLINE void LL_TIM_SetOCRefClearInputSource(TIM_TypeDef *TIMx, uint32_t OCRefClearInputSource)
Kojto 158:b23ee177fd68 2584 {
Kojto 158:b23ee177fd68 2585 MODIFY_REG(TIMx->SMCR, TIM_SMCR_OCCS, OCRefClearInputSource);
Kojto 158:b23ee177fd68 2586 }
Kojto 158:b23ee177fd68 2587 /**
Kojto 158:b23ee177fd68 2588 * @}
Kojto 158:b23ee177fd68 2589 */
Kojto 158:b23ee177fd68 2590
Kojto 158:b23ee177fd68 2591 /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management
Kojto 158:b23ee177fd68 2592 * @{
Kojto 158:b23ee177fd68 2593 */
Kojto 158:b23ee177fd68 2594 /**
Kojto 158:b23ee177fd68 2595 * @brief Clear the update interrupt flag (UIF).
Kojto 158:b23ee177fd68 2596 * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE
Kojto 158:b23ee177fd68 2597 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2598 * @retval None
Kojto 158:b23ee177fd68 2599 */
Anna Bridge 186:707f6e361f3e 2600 __STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2601 {
Kojto 158:b23ee177fd68 2602 WRITE_REG(TIMx->SR, ~(TIM_SR_UIF));
Kojto 158:b23ee177fd68 2603 }
Kojto 158:b23ee177fd68 2604
Kojto 158:b23ee177fd68 2605 /**
Kojto 158:b23ee177fd68 2606 * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending).
Kojto 158:b23ee177fd68 2607 * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE
Kojto 158:b23ee177fd68 2608 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2609 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2610 */
Anna Bridge 186:707f6e361f3e 2611 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2612 {
Kojto 158:b23ee177fd68 2613 return (READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF));
Kojto 158:b23ee177fd68 2614 }
Kojto 158:b23ee177fd68 2615
Kojto 158:b23ee177fd68 2616 /**
Kojto 158:b23ee177fd68 2617 * @brief Clear the Capture/Compare 1 interrupt flag (CC1F).
Kojto 158:b23ee177fd68 2618 * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1
Kojto 158:b23ee177fd68 2619 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2620 * @retval None
Kojto 158:b23ee177fd68 2621 */
Anna Bridge 186:707f6e361f3e 2622 __STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2623 {
Kojto 158:b23ee177fd68 2624 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF));
Kojto 158:b23ee177fd68 2625 }
Kojto 158:b23ee177fd68 2626
Kojto 158:b23ee177fd68 2627 /**
Kojto 158:b23ee177fd68 2628 * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending).
Kojto 158:b23ee177fd68 2629 * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1
Kojto 158:b23ee177fd68 2630 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2631 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2632 */
Anna Bridge 186:707f6e361f3e 2633 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2634 {
Kojto 158:b23ee177fd68 2635 return (READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF));
Kojto 158:b23ee177fd68 2636 }
Kojto 158:b23ee177fd68 2637
Kojto 158:b23ee177fd68 2638 /**
Kojto 158:b23ee177fd68 2639 * @brief Clear the Capture/Compare 2 interrupt flag (CC2F).
Kojto 158:b23ee177fd68 2640 * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2
Kojto 158:b23ee177fd68 2641 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2642 * @retval None
Kojto 158:b23ee177fd68 2643 */
Anna Bridge 186:707f6e361f3e 2644 __STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2645 {
Kojto 158:b23ee177fd68 2646 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF));
Kojto 158:b23ee177fd68 2647 }
Kojto 158:b23ee177fd68 2648
Kojto 158:b23ee177fd68 2649 /**
Kojto 158:b23ee177fd68 2650 * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending).
Kojto 158:b23ee177fd68 2651 * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2
Kojto 158:b23ee177fd68 2652 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2653 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2654 */
Anna Bridge 186:707f6e361f3e 2655 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2656 {
Kojto 158:b23ee177fd68 2657 return (READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF));
Kojto 158:b23ee177fd68 2658 }
Kojto 158:b23ee177fd68 2659
Kojto 158:b23ee177fd68 2660 /**
Kojto 158:b23ee177fd68 2661 * @brief Clear the Capture/Compare 3 interrupt flag (CC3F).
Kojto 158:b23ee177fd68 2662 * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3
Kojto 158:b23ee177fd68 2663 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2664 * @retval None
Kojto 158:b23ee177fd68 2665 */
Anna Bridge 186:707f6e361f3e 2666 __STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2667 {
Kojto 158:b23ee177fd68 2668 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF));
Kojto 158:b23ee177fd68 2669 }
Kojto 158:b23ee177fd68 2670
Kojto 158:b23ee177fd68 2671 /**
Kojto 158:b23ee177fd68 2672 * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending).
Kojto 158:b23ee177fd68 2673 * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3
Kojto 158:b23ee177fd68 2674 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2675 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2676 */
Anna Bridge 186:707f6e361f3e 2677 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2678 {
Kojto 158:b23ee177fd68 2679 return (READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF));
Kojto 158:b23ee177fd68 2680 }
Kojto 158:b23ee177fd68 2681
Kojto 158:b23ee177fd68 2682 /**
Kojto 158:b23ee177fd68 2683 * @brief Clear the Capture/Compare 4 interrupt flag (CC4F).
Kojto 158:b23ee177fd68 2684 * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4
Kojto 158:b23ee177fd68 2685 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2686 * @retval None
Kojto 158:b23ee177fd68 2687 */
Anna Bridge 186:707f6e361f3e 2688 __STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2689 {
Kojto 158:b23ee177fd68 2690 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF));
Kojto 158:b23ee177fd68 2691 }
Kojto 158:b23ee177fd68 2692
Kojto 158:b23ee177fd68 2693 /**
Kojto 158:b23ee177fd68 2694 * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending).
Kojto 158:b23ee177fd68 2695 * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4
Kojto 158:b23ee177fd68 2696 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2697 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2698 */
Anna Bridge 186:707f6e361f3e 2699 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2700 {
Kojto 158:b23ee177fd68 2701 return (READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF));
Kojto 158:b23ee177fd68 2702 }
Kojto 158:b23ee177fd68 2703
Kojto 158:b23ee177fd68 2704 /**
Kojto 158:b23ee177fd68 2705 * @brief Clear the trigger interrupt flag (TIF).
Kojto 158:b23ee177fd68 2706 * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG
Kojto 158:b23ee177fd68 2707 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2708 * @retval None
Kojto 158:b23ee177fd68 2709 */
Anna Bridge 186:707f6e361f3e 2710 __STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2711 {
Kojto 158:b23ee177fd68 2712 WRITE_REG(TIMx->SR, ~(TIM_SR_TIF));
Kojto 158:b23ee177fd68 2713 }
Kojto 158:b23ee177fd68 2714
Kojto 158:b23ee177fd68 2715 /**
Kojto 158:b23ee177fd68 2716 * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending).
Kojto 158:b23ee177fd68 2717 * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG
Kojto 158:b23ee177fd68 2718 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2719 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2720 */
Anna Bridge 186:707f6e361f3e 2721 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2722 {
Kojto 158:b23ee177fd68 2723 return (READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF));
Kojto 158:b23ee177fd68 2724 }
Kojto 158:b23ee177fd68 2725
Kojto 158:b23ee177fd68 2726 /**
Kojto 158:b23ee177fd68 2727 * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF).
Kojto 158:b23ee177fd68 2728 * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR
Kojto 158:b23ee177fd68 2729 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2730 * @retval None
Kojto 158:b23ee177fd68 2731 */
Anna Bridge 186:707f6e361f3e 2732 __STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2733 {
Kojto 158:b23ee177fd68 2734 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF));
Kojto 158:b23ee177fd68 2735 }
Kojto 158:b23ee177fd68 2736
Kojto 158:b23ee177fd68 2737 /**
Kojto 158:b23ee177fd68 2738 * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set (Capture/Compare 1 interrupt is pending).
Kojto 158:b23ee177fd68 2739 * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR
Kojto 158:b23ee177fd68 2740 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2741 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2742 */
Anna Bridge 186:707f6e361f3e 2743 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2744 {
Kojto 158:b23ee177fd68 2745 return (READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF));
Kojto 158:b23ee177fd68 2746 }
Kojto 158:b23ee177fd68 2747
Kojto 158:b23ee177fd68 2748 /**
Kojto 158:b23ee177fd68 2749 * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF).
Kojto 158:b23ee177fd68 2750 * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR
Kojto 158:b23ee177fd68 2751 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2752 * @retval None
Kojto 158:b23ee177fd68 2753 */
Anna Bridge 186:707f6e361f3e 2754 __STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2755 {
Kojto 158:b23ee177fd68 2756 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF));
Kojto 158:b23ee177fd68 2757 }
Kojto 158:b23ee177fd68 2758
Kojto 158:b23ee177fd68 2759 /**
Kojto 158:b23ee177fd68 2760 * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set (Capture/Compare 2 over-capture interrupt is pending).
Kojto 158:b23ee177fd68 2761 * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR
Kojto 158:b23ee177fd68 2762 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2763 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2764 */
Anna Bridge 186:707f6e361f3e 2765 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2766 {
Kojto 158:b23ee177fd68 2767 return (READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF));
Kojto 158:b23ee177fd68 2768 }
Kojto 158:b23ee177fd68 2769
Kojto 158:b23ee177fd68 2770 /**
Kojto 158:b23ee177fd68 2771 * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF).
Kojto 158:b23ee177fd68 2772 * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR
Kojto 158:b23ee177fd68 2773 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2774 * @retval None
Kojto 158:b23ee177fd68 2775 */
Anna Bridge 186:707f6e361f3e 2776 __STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2777 {
Kojto 158:b23ee177fd68 2778 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF));
Kojto 158:b23ee177fd68 2779 }
Kojto 158:b23ee177fd68 2780
Kojto 158:b23ee177fd68 2781 /**
Kojto 158:b23ee177fd68 2782 * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set (Capture/Compare 3 over-capture interrupt is pending).
Kojto 158:b23ee177fd68 2783 * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR
Kojto 158:b23ee177fd68 2784 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2785 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2786 */
Anna Bridge 186:707f6e361f3e 2787 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2788 {
Kojto 158:b23ee177fd68 2789 return (READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF));
Kojto 158:b23ee177fd68 2790 }
Kojto 158:b23ee177fd68 2791
Kojto 158:b23ee177fd68 2792 /**
Kojto 158:b23ee177fd68 2793 * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF).
Kojto 158:b23ee177fd68 2794 * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR
Kojto 158:b23ee177fd68 2795 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2796 * @retval None
Kojto 158:b23ee177fd68 2797 */
Anna Bridge 186:707f6e361f3e 2798 __STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2799 {
Kojto 158:b23ee177fd68 2800 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF));
Kojto 158:b23ee177fd68 2801 }
Kojto 158:b23ee177fd68 2802
Kojto 158:b23ee177fd68 2803 /**
Kojto 158:b23ee177fd68 2804 * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set (Capture/Compare 4 over-capture interrupt is pending).
Kojto 158:b23ee177fd68 2805 * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR
Kojto 158:b23ee177fd68 2806 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2807 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2808 */
Anna Bridge 186:707f6e361f3e 2809 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2810 {
Kojto 158:b23ee177fd68 2811 return (READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF));
Kojto 158:b23ee177fd68 2812 }
Kojto 158:b23ee177fd68 2813
Kojto 158:b23ee177fd68 2814 /**
Kojto 158:b23ee177fd68 2815 * @}
Kojto 158:b23ee177fd68 2816 */
Kojto 158:b23ee177fd68 2817
Kojto 158:b23ee177fd68 2818 /** @defgroup TIM_LL_EF_IT_Management IT-Management
Kojto 158:b23ee177fd68 2819 * @{
Kojto 158:b23ee177fd68 2820 */
Kojto 158:b23ee177fd68 2821 /**
Kojto 158:b23ee177fd68 2822 * @brief Enable update interrupt (UIE).
Kojto 158:b23ee177fd68 2823 * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE
Kojto 158:b23ee177fd68 2824 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2825 * @retval None
Kojto 158:b23ee177fd68 2826 */
Anna Bridge 186:707f6e361f3e 2827 __STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2828 {
Kojto 158:b23ee177fd68 2829 SET_BIT(TIMx->DIER, TIM_DIER_UIE);
Kojto 158:b23ee177fd68 2830 }
Kojto 158:b23ee177fd68 2831
Kojto 158:b23ee177fd68 2832 /**
Kojto 158:b23ee177fd68 2833 * @brief Disable update interrupt (UIE).
Kojto 158:b23ee177fd68 2834 * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE
Kojto 158:b23ee177fd68 2835 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2836 * @retval None
Kojto 158:b23ee177fd68 2837 */
Anna Bridge 186:707f6e361f3e 2838 __STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2839 {
Kojto 158:b23ee177fd68 2840 CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE);
Kojto 158:b23ee177fd68 2841 }
Kojto 158:b23ee177fd68 2842
Kojto 158:b23ee177fd68 2843 /**
Kojto 158:b23ee177fd68 2844 * @brief Indicates whether the update interrupt (UIE) is enabled.
Kojto 158:b23ee177fd68 2845 * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE
Kojto 158:b23ee177fd68 2846 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2847 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2848 */
Anna Bridge 186:707f6e361f3e 2849 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2850 {
Kojto 158:b23ee177fd68 2851 return (READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE));
Kojto 158:b23ee177fd68 2852 }
Kojto 158:b23ee177fd68 2853
Kojto 158:b23ee177fd68 2854 /**
Kojto 158:b23ee177fd68 2855 * @brief Enable capture/compare 1 interrupt (CC1IE).
Kojto 158:b23ee177fd68 2856 * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1
Kojto 158:b23ee177fd68 2857 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2858 * @retval None
Kojto 158:b23ee177fd68 2859 */
Anna Bridge 186:707f6e361f3e 2860 __STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2861 {
Kojto 158:b23ee177fd68 2862 SET_BIT(TIMx->DIER, TIM_DIER_CC1IE);
Kojto 158:b23ee177fd68 2863 }
Kojto 158:b23ee177fd68 2864
Kojto 158:b23ee177fd68 2865 /**
Kojto 158:b23ee177fd68 2866 * @brief Disable capture/compare 1 interrupt (CC1IE).
Kojto 158:b23ee177fd68 2867 * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1
Kojto 158:b23ee177fd68 2868 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2869 * @retval None
Kojto 158:b23ee177fd68 2870 */
Anna Bridge 186:707f6e361f3e 2871 __STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2872 {
Kojto 158:b23ee177fd68 2873 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE);
Kojto 158:b23ee177fd68 2874 }
Kojto 158:b23ee177fd68 2875
Kojto 158:b23ee177fd68 2876 /**
Kojto 158:b23ee177fd68 2877 * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled.
Kojto 158:b23ee177fd68 2878 * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1
Kojto 158:b23ee177fd68 2879 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2880 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2881 */
Anna Bridge 186:707f6e361f3e 2882 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2883 {
Kojto 158:b23ee177fd68 2884 return (READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE));
Kojto 158:b23ee177fd68 2885 }
Kojto 158:b23ee177fd68 2886
Kojto 158:b23ee177fd68 2887 /**
Kojto 158:b23ee177fd68 2888 * @brief Enable capture/compare 2 interrupt (CC2IE).
Kojto 158:b23ee177fd68 2889 * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2
Kojto 158:b23ee177fd68 2890 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2891 * @retval None
Kojto 158:b23ee177fd68 2892 */
Anna Bridge 186:707f6e361f3e 2893 __STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2894 {
Kojto 158:b23ee177fd68 2895 SET_BIT(TIMx->DIER, TIM_DIER_CC2IE);
Kojto 158:b23ee177fd68 2896 }
Kojto 158:b23ee177fd68 2897
Kojto 158:b23ee177fd68 2898 /**
Kojto 158:b23ee177fd68 2899 * @brief Disable capture/compare 2 interrupt (CC2IE).
Kojto 158:b23ee177fd68 2900 * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2
Kojto 158:b23ee177fd68 2901 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2902 * @retval None
Kojto 158:b23ee177fd68 2903 */
Anna Bridge 186:707f6e361f3e 2904 __STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2905 {
Kojto 158:b23ee177fd68 2906 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE);
Kojto 158:b23ee177fd68 2907 }
Kojto 158:b23ee177fd68 2908
Kojto 158:b23ee177fd68 2909 /**
Kojto 158:b23ee177fd68 2910 * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled.
Kojto 158:b23ee177fd68 2911 * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2
Kojto 158:b23ee177fd68 2912 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2913 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2914 */
Anna Bridge 186:707f6e361f3e 2915 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2916 {
Kojto 158:b23ee177fd68 2917 return (READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE));
Kojto 158:b23ee177fd68 2918 }
Kojto 158:b23ee177fd68 2919
Kojto 158:b23ee177fd68 2920 /**
Kojto 158:b23ee177fd68 2921 * @brief Enable capture/compare 3 interrupt (CC3IE).
Kojto 158:b23ee177fd68 2922 * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3
Kojto 158:b23ee177fd68 2923 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2924 * @retval None
Kojto 158:b23ee177fd68 2925 */
Anna Bridge 186:707f6e361f3e 2926 __STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2927 {
Kojto 158:b23ee177fd68 2928 SET_BIT(TIMx->DIER, TIM_DIER_CC3IE);
Kojto 158:b23ee177fd68 2929 }
Kojto 158:b23ee177fd68 2930
Kojto 158:b23ee177fd68 2931 /**
Kojto 158:b23ee177fd68 2932 * @brief Disable capture/compare 3 interrupt (CC3IE).
Kojto 158:b23ee177fd68 2933 * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3
Kojto 158:b23ee177fd68 2934 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2935 * @retval None
Kojto 158:b23ee177fd68 2936 */
Anna Bridge 186:707f6e361f3e 2937 __STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2938 {
Kojto 158:b23ee177fd68 2939 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE);
Kojto 158:b23ee177fd68 2940 }
Kojto 158:b23ee177fd68 2941
Kojto 158:b23ee177fd68 2942 /**
Kojto 158:b23ee177fd68 2943 * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled.
Kojto 158:b23ee177fd68 2944 * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3
Kojto 158:b23ee177fd68 2945 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2946 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2947 */
Anna Bridge 186:707f6e361f3e 2948 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2949 {
Kojto 158:b23ee177fd68 2950 return (READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE));
Kojto 158:b23ee177fd68 2951 }
Kojto 158:b23ee177fd68 2952
Kojto 158:b23ee177fd68 2953 /**
Kojto 158:b23ee177fd68 2954 * @brief Enable capture/compare 4 interrupt (CC4IE).
Kojto 158:b23ee177fd68 2955 * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4
Kojto 158:b23ee177fd68 2956 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2957 * @retval None
Kojto 158:b23ee177fd68 2958 */
Anna Bridge 186:707f6e361f3e 2959 __STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2960 {
Kojto 158:b23ee177fd68 2961 SET_BIT(TIMx->DIER, TIM_DIER_CC4IE);
Kojto 158:b23ee177fd68 2962 }
Kojto 158:b23ee177fd68 2963
Kojto 158:b23ee177fd68 2964 /**
Kojto 158:b23ee177fd68 2965 * @brief Disable capture/compare 4 interrupt (CC4IE).
Kojto 158:b23ee177fd68 2966 * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4
Kojto 158:b23ee177fd68 2967 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2968 * @retval None
Kojto 158:b23ee177fd68 2969 */
Anna Bridge 186:707f6e361f3e 2970 __STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2971 {
Kojto 158:b23ee177fd68 2972 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE);
Kojto 158:b23ee177fd68 2973 }
Kojto 158:b23ee177fd68 2974
Kojto 158:b23ee177fd68 2975 /**
Kojto 158:b23ee177fd68 2976 * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled.
Kojto 158:b23ee177fd68 2977 * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4
Kojto 158:b23ee177fd68 2978 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2979 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 2980 */
Anna Bridge 186:707f6e361f3e 2981 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2982 {
Kojto 158:b23ee177fd68 2983 return (READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE));
Kojto 158:b23ee177fd68 2984 }
Kojto 158:b23ee177fd68 2985
Kojto 158:b23ee177fd68 2986 /**
Kojto 158:b23ee177fd68 2987 * @brief Enable trigger interrupt (TIE).
Kojto 158:b23ee177fd68 2988 * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG
Kojto 158:b23ee177fd68 2989 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 2990 * @retval None
Kojto 158:b23ee177fd68 2991 */
Anna Bridge 186:707f6e361f3e 2992 __STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 2993 {
Kojto 158:b23ee177fd68 2994 SET_BIT(TIMx->DIER, TIM_DIER_TIE);
Kojto 158:b23ee177fd68 2995 }
Kojto 158:b23ee177fd68 2996
Kojto 158:b23ee177fd68 2997 /**
Kojto 158:b23ee177fd68 2998 * @brief Disable trigger interrupt (TIE).
Kojto 158:b23ee177fd68 2999 * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG
Kojto 158:b23ee177fd68 3000 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3001 * @retval None
Kojto 158:b23ee177fd68 3002 */
Anna Bridge 186:707f6e361f3e 3003 __STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3004 {
Kojto 158:b23ee177fd68 3005 CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE);
Kojto 158:b23ee177fd68 3006 }
Kojto 158:b23ee177fd68 3007
Kojto 158:b23ee177fd68 3008 /**
Kojto 158:b23ee177fd68 3009 * @brief Indicates whether the trigger interrupt (TIE) is enabled.
Kojto 158:b23ee177fd68 3010 * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG
Kojto 158:b23ee177fd68 3011 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3012 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3013 */
Anna Bridge 186:707f6e361f3e 3014 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3015 {
Kojto 158:b23ee177fd68 3016 return (READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE));
Kojto 158:b23ee177fd68 3017 }
Kojto 158:b23ee177fd68 3018
Kojto 158:b23ee177fd68 3019 /**
Kojto 158:b23ee177fd68 3020 * @}
Kojto 158:b23ee177fd68 3021 */
Kojto 158:b23ee177fd68 3022
Kojto 158:b23ee177fd68 3023 /** @defgroup TIM_LL_EF_DMA_Management DMA-Management
Kojto 158:b23ee177fd68 3024 * @{
Kojto 158:b23ee177fd68 3025 */
Kojto 158:b23ee177fd68 3026 /**
Kojto 158:b23ee177fd68 3027 * @brief Enable update DMA request (UDE).
Kojto 158:b23ee177fd68 3028 * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE
Kojto 158:b23ee177fd68 3029 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3030 * @retval None
Kojto 158:b23ee177fd68 3031 */
Anna Bridge 186:707f6e361f3e 3032 __STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3033 {
Kojto 158:b23ee177fd68 3034 SET_BIT(TIMx->DIER, TIM_DIER_UDE);
Kojto 158:b23ee177fd68 3035 }
Kojto 158:b23ee177fd68 3036
Kojto 158:b23ee177fd68 3037 /**
Kojto 158:b23ee177fd68 3038 * @brief Disable update DMA request (UDE).
Kojto 158:b23ee177fd68 3039 * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE
Kojto 158:b23ee177fd68 3040 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3041 * @retval None
Kojto 158:b23ee177fd68 3042 */
Anna Bridge 186:707f6e361f3e 3043 __STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3044 {
Kojto 158:b23ee177fd68 3045 CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE);
Kojto 158:b23ee177fd68 3046 }
Kojto 158:b23ee177fd68 3047
Kojto 158:b23ee177fd68 3048 /**
Kojto 158:b23ee177fd68 3049 * @brief Indicates whether the update DMA request (UDE) is enabled.
Kojto 158:b23ee177fd68 3050 * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE
Kojto 158:b23ee177fd68 3051 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3052 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3053 */
Anna Bridge 186:707f6e361f3e 3054 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3055 {
Kojto 158:b23ee177fd68 3056 return (READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE));
Kojto 158:b23ee177fd68 3057 }
Kojto 158:b23ee177fd68 3058
Kojto 158:b23ee177fd68 3059 /**
Kojto 158:b23ee177fd68 3060 * @brief Enable capture/compare 1 DMA request (CC1DE).
Kojto 158:b23ee177fd68 3061 * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1
Kojto 158:b23ee177fd68 3062 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3063 * @retval None
Kojto 158:b23ee177fd68 3064 */
Anna Bridge 186:707f6e361f3e 3065 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3066 {
Kojto 158:b23ee177fd68 3067 SET_BIT(TIMx->DIER, TIM_DIER_CC1DE);
Kojto 158:b23ee177fd68 3068 }
Kojto 158:b23ee177fd68 3069
Kojto 158:b23ee177fd68 3070 /**
Kojto 158:b23ee177fd68 3071 * @brief Disable capture/compare 1 DMA request (CC1DE).
Kojto 158:b23ee177fd68 3072 * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1
Kojto 158:b23ee177fd68 3073 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3074 * @retval None
Kojto 158:b23ee177fd68 3075 */
Anna Bridge 186:707f6e361f3e 3076 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3077 {
Kojto 158:b23ee177fd68 3078 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE);
Kojto 158:b23ee177fd68 3079 }
Kojto 158:b23ee177fd68 3080
Kojto 158:b23ee177fd68 3081 /**
Kojto 158:b23ee177fd68 3082 * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled.
Kojto 158:b23ee177fd68 3083 * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1
Kojto 158:b23ee177fd68 3084 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3085 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3086 */
Anna Bridge 186:707f6e361f3e 3087 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3088 {
Kojto 158:b23ee177fd68 3089 return (READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE));
Kojto 158:b23ee177fd68 3090 }
Kojto 158:b23ee177fd68 3091
Kojto 158:b23ee177fd68 3092 /**
Kojto 158:b23ee177fd68 3093 * @brief Enable capture/compare 2 DMA request (CC2DE).
Kojto 158:b23ee177fd68 3094 * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2
Kojto 158:b23ee177fd68 3095 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3096 * @retval None
Kojto 158:b23ee177fd68 3097 */
Anna Bridge 186:707f6e361f3e 3098 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3099 {
Kojto 158:b23ee177fd68 3100 SET_BIT(TIMx->DIER, TIM_DIER_CC2DE);
Kojto 158:b23ee177fd68 3101 }
Kojto 158:b23ee177fd68 3102
Kojto 158:b23ee177fd68 3103 /**
Kojto 158:b23ee177fd68 3104 * @brief Disable capture/compare 2 DMA request (CC2DE).
Kojto 158:b23ee177fd68 3105 * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2
Kojto 158:b23ee177fd68 3106 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3107 * @retval None
Kojto 158:b23ee177fd68 3108 */
Anna Bridge 186:707f6e361f3e 3109 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3110 {
Kojto 158:b23ee177fd68 3111 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE);
Kojto 158:b23ee177fd68 3112 }
Kojto 158:b23ee177fd68 3113
Kojto 158:b23ee177fd68 3114 /**
Kojto 158:b23ee177fd68 3115 * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled.
Kojto 158:b23ee177fd68 3116 * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2
Kojto 158:b23ee177fd68 3117 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3118 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3119 */
Anna Bridge 186:707f6e361f3e 3120 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3121 {
Kojto 158:b23ee177fd68 3122 return (READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE));
Kojto 158:b23ee177fd68 3123 }
Kojto 158:b23ee177fd68 3124
Kojto 158:b23ee177fd68 3125 /**
Kojto 158:b23ee177fd68 3126 * @brief Enable capture/compare 3 DMA request (CC3DE).
Kojto 158:b23ee177fd68 3127 * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3
Kojto 158:b23ee177fd68 3128 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3129 * @retval None
Kojto 158:b23ee177fd68 3130 */
Anna Bridge 186:707f6e361f3e 3131 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3132 {
Kojto 158:b23ee177fd68 3133 SET_BIT(TIMx->DIER, TIM_DIER_CC3DE);
Kojto 158:b23ee177fd68 3134 }
Kojto 158:b23ee177fd68 3135
Kojto 158:b23ee177fd68 3136 /**
Kojto 158:b23ee177fd68 3137 * @brief Disable capture/compare 3 DMA request (CC3DE).
Kojto 158:b23ee177fd68 3138 * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3
Kojto 158:b23ee177fd68 3139 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3140 * @retval None
Kojto 158:b23ee177fd68 3141 */
Anna Bridge 186:707f6e361f3e 3142 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3143 {
Kojto 158:b23ee177fd68 3144 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE);
Kojto 158:b23ee177fd68 3145 }
Kojto 158:b23ee177fd68 3146
Kojto 158:b23ee177fd68 3147 /**
Kojto 158:b23ee177fd68 3148 * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled.
Kojto 158:b23ee177fd68 3149 * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3
Kojto 158:b23ee177fd68 3150 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3151 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3152 */
Anna Bridge 186:707f6e361f3e 3153 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3154 {
Kojto 158:b23ee177fd68 3155 return (READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE));
Kojto 158:b23ee177fd68 3156 }
Kojto 158:b23ee177fd68 3157
Kojto 158:b23ee177fd68 3158 /**
Kojto 158:b23ee177fd68 3159 * @brief Enable capture/compare 4 DMA request (CC4DE).
Kojto 158:b23ee177fd68 3160 * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4
Kojto 158:b23ee177fd68 3161 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3162 * @retval None
Kojto 158:b23ee177fd68 3163 */
Anna Bridge 186:707f6e361f3e 3164 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3165 {
Kojto 158:b23ee177fd68 3166 SET_BIT(TIMx->DIER, TIM_DIER_CC4DE);
Kojto 158:b23ee177fd68 3167 }
Kojto 158:b23ee177fd68 3168
Kojto 158:b23ee177fd68 3169 /**
Kojto 158:b23ee177fd68 3170 * @brief Disable capture/compare 4 DMA request (CC4DE).
Kojto 158:b23ee177fd68 3171 * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4
Kojto 158:b23ee177fd68 3172 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3173 * @retval None
Kojto 158:b23ee177fd68 3174 */
Anna Bridge 186:707f6e361f3e 3175 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3176 {
Kojto 158:b23ee177fd68 3177 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE);
Kojto 158:b23ee177fd68 3178 }
Kojto 158:b23ee177fd68 3179
Kojto 158:b23ee177fd68 3180 /**
Kojto 158:b23ee177fd68 3181 * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled.
Kojto 158:b23ee177fd68 3182 * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4
Kojto 158:b23ee177fd68 3183 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3184 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3185 */
Anna Bridge 186:707f6e361f3e 3186 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3187 {
Kojto 158:b23ee177fd68 3188 return (READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE));
Kojto 158:b23ee177fd68 3189 }
Kojto 158:b23ee177fd68 3190
Kojto 158:b23ee177fd68 3191 /**
Kojto 158:b23ee177fd68 3192 * @brief Enable trigger interrupt (TDE).
Kojto 158:b23ee177fd68 3193 * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG
Kojto 158:b23ee177fd68 3194 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3195 * @retval None
Kojto 158:b23ee177fd68 3196 */
Anna Bridge 186:707f6e361f3e 3197 __STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3198 {
Kojto 158:b23ee177fd68 3199 SET_BIT(TIMx->DIER, TIM_DIER_TDE);
Kojto 158:b23ee177fd68 3200 }
Kojto 158:b23ee177fd68 3201
Kojto 158:b23ee177fd68 3202 /**
Kojto 158:b23ee177fd68 3203 * @brief Disable trigger interrupt (TDE).
Kojto 158:b23ee177fd68 3204 * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG
Kojto 158:b23ee177fd68 3205 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3206 * @retval None
Kojto 158:b23ee177fd68 3207 */
Anna Bridge 186:707f6e361f3e 3208 __STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3209 {
Kojto 158:b23ee177fd68 3210 CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE);
Kojto 158:b23ee177fd68 3211 }
Kojto 158:b23ee177fd68 3212
Kojto 158:b23ee177fd68 3213 /**
Kojto 158:b23ee177fd68 3214 * @brief Indicates whether the trigger interrupt (TDE) is enabled.
Kojto 158:b23ee177fd68 3215 * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG
Kojto 158:b23ee177fd68 3216 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3217 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 3218 */
Anna Bridge 186:707f6e361f3e 3219 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3220 {
Kojto 158:b23ee177fd68 3221 return (READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE));
Kojto 158:b23ee177fd68 3222 }
Kojto 158:b23ee177fd68 3223
Kojto 158:b23ee177fd68 3224 /**
Kojto 158:b23ee177fd68 3225 * @}
Kojto 158:b23ee177fd68 3226 */
Kojto 158:b23ee177fd68 3227
Kojto 158:b23ee177fd68 3228 /** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management
Kojto 158:b23ee177fd68 3229 * @{
Kojto 158:b23ee177fd68 3230 */
Kojto 158:b23ee177fd68 3231 /**
Kojto 158:b23ee177fd68 3232 * @brief Generate an update event.
Kojto 158:b23ee177fd68 3233 * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE
Kojto 158:b23ee177fd68 3234 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3235 * @retval None
Kojto 158:b23ee177fd68 3236 */
Anna Bridge 186:707f6e361f3e 3237 __STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3238 {
Kojto 158:b23ee177fd68 3239 SET_BIT(TIMx->EGR, TIM_EGR_UG);
Kojto 158:b23ee177fd68 3240 }
Kojto 158:b23ee177fd68 3241
Kojto 158:b23ee177fd68 3242 /**
Kojto 158:b23ee177fd68 3243 * @brief Generate Capture/Compare 1 event.
Kojto 158:b23ee177fd68 3244 * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1
Kojto 158:b23ee177fd68 3245 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3246 * @retval None
Kojto 158:b23ee177fd68 3247 */
Anna Bridge 186:707f6e361f3e 3248 __STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3249 {
Kojto 158:b23ee177fd68 3250 SET_BIT(TIMx->EGR, TIM_EGR_CC1G);
Kojto 158:b23ee177fd68 3251 }
Kojto 158:b23ee177fd68 3252
Kojto 158:b23ee177fd68 3253 /**
Kojto 158:b23ee177fd68 3254 * @brief Generate Capture/Compare 2 event.
Kojto 158:b23ee177fd68 3255 * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2
Kojto 158:b23ee177fd68 3256 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3257 * @retval None
Kojto 158:b23ee177fd68 3258 */
Anna Bridge 186:707f6e361f3e 3259 __STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3260 {
Kojto 158:b23ee177fd68 3261 SET_BIT(TIMx->EGR, TIM_EGR_CC2G);
Kojto 158:b23ee177fd68 3262 }
Kojto 158:b23ee177fd68 3263
Kojto 158:b23ee177fd68 3264 /**
Kojto 158:b23ee177fd68 3265 * @brief Generate Capture/Compare 3 event.
Kojto 158:b23ee177fd68 3266 * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3
Kojto 158:b23ee177fd68 3267 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3268 * @retval None
Kojto 158:b23ee177fd68 3269 */
Anna Bridge 186:707f6e361f3e 3270 __STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3271 {
Kojto 158:b23ee177fd68 3272 SET_BIT(TIMx->EGR, TIM_EGR_CC3G);
Kojto 158:b23ee177fd68 3273 }
Kojto 158:b23ee177fd68 3274
Kojto 158:b23ee177fd68 3275 /**
Kojto 158:b23ee177fd68 3276 * @brief Generate Capture/Compare 4 event.
Kojto 158:b23ee177fd68 3277 * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4
Kojto 158:b23ee177fd68 3278 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3279 * @retval None
Kojto 158:b23ee177fd68 3280 */
Anna Bridge 186:707f6e361f3e 3281 __STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3282 {
Kojto 158:b23ee177fd68 3283 SET_BIT(TIMx->EGR, TIM_EGR_CC4G);
Kojto 158:b23ee177fd68 3284 }
Kojto 158:b23ee177fd68 3285
Kojto 158:b23ee177fd68 3286 /**
Kojto 158:b23ee177fd68 3287 * @brief Generate trigger event.
Kojto 158:b23ee177fd68 3288 * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG
Kojto 158:b23ee177fd68 3289 * @param TIMx Timer instance
Kojto 158:b23ee177fd68 3290 * @retval None
Kojto 158:b23ee177fd68 3291 */
Anna Bridge 186:707f6e361f3e 3292 __STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx)
Kojto 158:b23ee177fd68 3293 {
Kojto 158:b23ee177fd68 3294 SET_BIT(TIMx->EGR, TIM_EGR_TG);
Kojto 158:b23ee177fd68 3295 }
Kojto 158:b23ee177fd68 3296
Kojto 158:b23ee177fd68 3297 /**
Kojto 158:b23ee177fd68 3298 * @}
Kojto 158:b23ee177fd68 3299 */
Kojto 158:b23ee177fd68 3300
Kojto 158:b23ee177fd68 3301 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 3302 /** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions
Kojto 158:b23ee177fd68 3303 * @{
Kojto 158:b23ee177fd68 3304 */
Anna Bridge 186:707f6e361f3e 3305
Anna Bridge 186:707f6e361f3e 3306 ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx);
Anna Bridge 186:707f6e361f3e 3307 void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct);
Anna Bridge 186:707f6e361f3e 3308 ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct);
Anna Bridge 186:707f6e361f3e 3309 void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
Anna Bridge 186:707f6e361f3e 3310 ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
Anna Bridge 186:707f6e361f3e 3311 void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
Anna Bridge 186:707f6e361f3e 3312 ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct);
Anna Bridge 186:707f6e361f3e 3313 void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
Anna Bridge 186:707f6e361f3e 3314 ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
Kojto 158:b23ee177fd68 3315 /**
Kojto 158:b23ee177fd68 3316 * @}
Kojto 158:b23ee177fd68 3317 */
Kojto 158:b23ee177fd68 3318 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 3319
Kojto 158:b23ee177fd68 3320 /**
Kojto 158:b23ee177fd68 3321 * @}
Kojto 158:b23ee177fd68 3322 */
Kojto 158:b23ee177fd68 3323
Kojto 158:b23ee177fd68 3324 /**
Kojto 158:b23ee177fd68 3325 * @}
Kojto 158:b23ee177fd68 3326 */
Kojto 158:b23ee177fd68 3327
Kojto 158:b23ee177fd68 3328 #endif /* TIM1 || TIM3 || TIM21 || TIM22 || TIM6 || TIM7 */
Kojto 158:b23ee177fd68 3329
Kojto 158:b23ee177fd68 3330 /**
Kojto 158:b23ee177fd68 3331 * @}
Kojto 158:b23ee177fd68 3332 */
Kojto 158:b23ee177fd68 3333
Kojto 158:b23ee177fd68 3334 #ifdef __cplusplus
Kojto 158:b23ee177fd68 3335 }
Kojto 158:b23ee177fd68 3336 #endif
Kojto 158:b23ee177fd68 3337
Kojto 158:b23ee177fd68 3338 #endif /* __STM32L0xx_LL_TIM_H */
Kojto 158:b23ee177fd68 3339
Kojto 158:b23ee177fd68 3340 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/