Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief TIM LL module driver. |
5 | * @brief TIM LL module driver. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 14 | * this list of conditions and the following disclaimer. |
- | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 20 | * without specific prior written permission. |
- | |
| 21 | * |
- | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 32 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| 35 | #if defined(USE_FULL_LL_DRIVER) |
19 | #if defined(USE_FULL_LL_DRIVER) |
| 36 | 20 | ||
| Line 40... | Line 24... | ||
| 40 | 24 | ||
| 41 | #ifdef USE_FULL_ASSERT |
25 | #ifdef USE_FULL_ASSERT |
| 42 | #include "stm32_assert.h" |
26 | #include "stm32_assert.h" |
| 43 | #else |
27 | #else |
| 44 | #define assert_param(expr) ((void)0U) |
28 | #define assert_param(expr) ((void)0U) |
| 45 | #endif |
29 | #endif /* USE_FULL_ASSERT */ |
| 46 | 30 | ||
| 47 | /** @addtogroup STM32F1xx_LL_Driver |
31 | /** @addtogroup STM32F1xx_LL_Driver |
| 48 | * @{ |
32 | * @{ |
| 49 | */ |
33 | */ |
| 50 | 34 | ||
| 51 | #if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) || defined (TIM15) || defined (TIM16) || defined (TIM17) |
35 | #if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) || defined (TIM15) || defined (TIM16) || defined (TIM17) |
| 52 | 36 | ||
| 53 | /** @addtogroup TIM_LL |
37 | /** @addtogroup TIM_LL |
| 54 | * @{ |
38 | * @{ |
| 55 | */ |
39 | */ |
| 56 | 40 | ||
| Line 60... | Line 44... | ||
| 60 | /* Private macros ------------------------------------------------------------*/ |
44 | /* Private macros ------------------------------------------------------------*/ |
| 61 | /** @addtogroup TIM_LL_Private_Macros |
45 | /** @addtogroup TIM_LL_Private_Macros |
| 62 | * @{ |
46 | * @{ |
| 63 | */ |
47 | */ |
| 64 | #define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \ |
48 | #define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \ |
| 65 | || ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \ |
49 | || ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \ |
| 66 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \ |
50 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \ |
| 67 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \ |
51 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \ |
| 68 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN)) |
52 | || ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN)) |
| 69 | 53 | ||
| 70 | #define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \ |
54 | #define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \ |
| 71 | || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \ |
55 | || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \ |
| 72 | || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4)) |
56 | || ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4)) |
| 73 | 57 | ||
| 74 | #define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \ |
58 | #define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \ |
| 75 | || ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \ |
59 | || ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \ |
| 76 | || ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \ |
60 | || ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \ |
| 77 | || ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \ |
61 | || ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \ |
| 78 | || ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \ |
62 | || ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \ |
| 79 | || ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \ |
63 | || ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \ |
| 80 | || ((__VALUE__) == LL_TIM_OCMODE_PWM1) \ |
64 | || ((__VALUE__) == LL_TIM_OCMODE_PWM1) \ |
| 81 | || ((__VALUE__) == LL_TIM_OCMODE_PWM2)) |
65 | || ((__VALUE__) == LL_TIM_OCMODE_PWM2)) |
| 82 | 66 | ||
| 83 | #define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \ |
67 | #define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \ |
| 84 | || ((__VALUE__) == LL_TIM_OCSTATE_ENABLE)) |
68 | || ((__VALUE__) == LL_TIM_OCSTATE_ENABLE)) |
| 85 | 69 | ||
| 86 | #define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \ |
70 | #define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \ |
| 87 | || ((__VALUE__) == LL_TIM_OCPOLARITY_LOW)) |
71 | || ((__VALUE__) == LL_TIM_OCPOLARITY_LOW)) |
| 88 | 72 | ||
| 89 | #define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \ |
73 | #define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \ |
| 90 | || ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH)) |
74 | || ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH)) |
| 91 | 75 | ||
| 92 | #define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \ |
76 | #define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \ |
| 93 | || ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \ |
77 | || ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \ |
| 94 | || ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC)) |
78 | || ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC)) |
| 95 | 79 | ||
| 96 | #define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \ |
80 | #define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \ |
| 97 | || ((__VALUE__) == LL_TIM_ICPSC_DIV2) \ |
81 | || ((__VALUE__) == LL_TIM_ICPSC_DIV2) \ |
| 98 | || ((__VALUE__) == LL_TIM_ICPSC_DIV4) \ |
82 | || ((__VALUE__) == LL_TIM_ICPSC_DIV4) \ |
| 99 | || ((__VALUE__) == LL_TIM_ICPSC_DIV8)) |
83 | || ((__VALUE__) == LL_TIM_ICPSC_DIV8)) |
| 100 | 84 | ||
| 101 | #define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \ |
85 | #define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \ |
| 102 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \ |
86 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \ |
| 103 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \ |
87 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \ |
| 104 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \ |
88 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \ |
| 105 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \ |
89 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \ |
| 106 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \ |
90 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \ |
| 107 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \ |
91 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \ |
| 108 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \ |
92 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \ |
| 109 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \ |
93 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \ |
| 110 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \ |
94 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \ |
| 111 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \ |
95 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \ |
| 112 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \ |
96 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \ |
| 113 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \ |
97 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \ |
| 114 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \ |
98 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \ |
| 115 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \ |
99 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \ |
| 116 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8)) |
100 | || ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8)) |
| 117 | 101 | ||
| 118 | #define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ |
102 | #define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ |
| 119 | || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) |
103 | || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) |
| 120 | 104 | ||
| 121 | #define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \ |
105 | #define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \ |
| 122 | || ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \ |
106 | || ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \ |
| 123 | || ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12)) |
107 | || ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12)) |
| 124 | 108 | ||
| 125 | #define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ |
109 | #define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \ |
| 126 | || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) |
110 | || ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING)) |
| 127 | 111 | ||
| 128 | #define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \ |
112 | #define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \ |
| 129 | || ((__VALUE__) == LL_TIM_OSSR_ENABLE)) |
113 | || ((__VALUE__) == LL_TIM_OSSR_ENABLE)) |
| 130 | 114 | ||
| 131 | #define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \ |
115 | #define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \ |
| 132 | || ((__VALUE__) == LL_TIM_OSSI_ENABLE)) |
116 | || ((__VALUE__) == LL_TIM_OSSI_ENABLE)) |
| 133 | 117 | ||
| 134 | #define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \ |
118 | #define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \ |
| 135 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \ |
119 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \ |
| 136 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \ |
120 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \ |
| 137 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_3)) |
121 | || ((__VALUE__) == LL_TIM_LOCKLEVEL_3)) |
| 138 | 122 | ||
| 139 | #define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \ |
123 | #define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \ |
| 140 | || ((__VALUE__) == LL_TIM_BREAK_ENABLE)) |
124 | || ((__VALUE__) == LL_TIM_BREAK_ENABLE)) |
| 141 | 125 | ||
| 142 | #define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \ |
126 | #define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \ |
| 143 | || ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH)) |
127 | || ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH)) |
| 144 | 128 | ||
| 145 | #define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \ |
129 | #define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \ |
| 146 | || ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE)) |
130 | || ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE)) |
| 147 | /** |
131 | /** |
| 148 | * @} |
132 | * @} |
| 149 | */ |
133 | */ |
| 150 | 134 | ||
| 151 | 135 | ||
| Line 324... | Line 308... | ||
| 324 | /* Set the default configuration */ |
308 | /* Set the default configuration */ |
| 325 | TIM_InitStruct->Prescaler = (uint16_t)0x0000; |
309 | TIM_InitStruct->Prescaler = (uint16_t)0x0000; |
| 326 | TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP; |
310 | TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP; |
| 327 | TIM_InitStruct->Autoreload = 0xFFFFFFFFU; |
311 | TIM_InitStruct->Autoreload = 0xFFFFFFFFU; |
| 328 | TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; |
312 | TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; |
| 329 | TIM_InitStruct->RepetitionCounter = (uint8_t)0x00; |
313 | TIM_InitStruct->RepetitionCounter = 0x00000000U; |
| 330 | } |
314 | } |
| 331 | 315 | ||
| 332 | /** |
316 | /** |
| 333 | * @brief Configure the TIMx time base unit. |
317 | * @brief Configure the TIMx time base unit. |
| 334 | * @param TIMx Timer Instance |
318 | * @param TIMx Timer Instance |
| Line 337... | Line 321... | ||
| 337 | * - SUCCESS: TIMx registers are de-initialized |
321 | * - SUCCESS: TIMx registers are de-initialized |
| 338 | * - ERROR: not applicable |
322 | * - ERROR: not applicable |
| 339 | */ |
323 | */ |
| 340 | ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct) |
324 | ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct) |
| 341 | { |
325 | { |
| 342 | uint32_t tmpcr1 = 0U; |
326 | uint32_t tmpcr1; |
| 343 | 327 | ||
| 344 | /* Check the parameters */ |
328 | /* Check the parameters */ |
| 345 | assert_param(IS_TIM_INSTANCE(TIMx)); |
329 | assert_param(IS_TIM_INSTANCE(TIMx)); |
| 346 | assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode)); |
330 | assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode)); |
| 347 | assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision)); |
331 | assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision)); |
| Line 519... | Line 503... | ||
| 519 | * - SUCCESS: TIMx registers are de-initialized |
503 | * - SUCCESS: TIMx registers are de-initialized |
| 520 | * - ERROR: not applicable |
504 | * - ERROR: not applicable |
| 521 | */ |
505 | */ |
| 522 | ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) |
506 | ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct) |
| 523 | { |
507 | { |
| 524 | uint32_t tmpccmr1 = 0U; |
508 | uint32_t tmpccmr1; |
| 525 | uint32_t tmpccer = 0U; |
509 | uint32_t tmpccer; |
| 526 | 510 | ||
| 527 | /* Check the parameters */ |
511 | /* Check the parameters */ |
| 528 | assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx)); |
512 | assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx)); |
| 529 | assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode)); |
513 | assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode)); |
| 530 | assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity)); |
514 | assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity)); |
| Line 608... | Line 592... | ||
| 608 | * - SUCCESS: TIMx registers are de-initialized |
592 | * - SUCCESS: TIMx registers are de-initialized |
| 609 | * - ERROR: not applicable |
593 | * - ERROR: not applicable |
| 610 | */ |
594 | */ |
| 611 | ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) |
595 | ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct) |
| 612 | { |
596 | { |
| 613 | uint32_t tmpcr2 = 0U; |
597 | uint32_t tmpcr2; |
| 614 | uint32_t tmpccmr1 = 0U; |
598 | uint32_t tmpccmr1; |
| 615 | uint32_t tmpccer = 0U; |
599 | uint32_t tmpccer; |
| 616 | uint32_t tmpsmcr = 0U; |
600 | uint32_t tmpsmcr; |
| 617 | 601 | ||
| 618 | /* Check the parameters */ |
602 | /* Check the parameters */ |
| 619 | assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx)); |
603 | assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx)); |
| 620 | assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity)); |
604 | assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity)); |
| 621 | assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler)); |
605 | assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler)); |
| Line 701... | Line 685... | ||
| 701 | /** |
685 | /** |
| 702 | * @brief Configure the Break and Dead Time feature of the timer instance. |
686 | * @brief Configure the Break and Dead Time feature of the timer instance. |
| 703 | * @note As the bits AOE, BKP, BKE, OSSR, OSSI and DTG[7:0] can be write-locked |
687 | * @note As the bits AOE, BKP, BKE, OSSR, OSSI and DTG[7:0] can be write-locked |
| 704 | * depending on the LOCK configuration, it can be necessary to configure all of |
688 | * depending on the LOCK configuration, it can be necessary to configure all of |
| 705 | * them during the first write access to the TIMx_BDTR register. |
689 | * them during the first write access to the TIMx_BDTR register. |
| 706 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
690 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 707 | * a timer instance provides a break input. |
691 | * a timer instance provides a break input. |
| 708 | * @param TIMx Timer Instance |
692 | * @param TIMx Timer Instance |
| 709 | * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure(Break and Dead Time configuration data structure) |
693 | * @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure) |
| 710 | * @retval An ErrorStatus enumeration value: |
694 | * @retval An ErrorStatus enumeration value: |
| 711 | * - SUCCESS: Break and Dead Time is initialized |
695 | * - SUCCESS: Break and Dead Time is initialized |
| 712 | * - ERROR: not applicable |
696 | * - ERROR: not applicable |
| 713 | */ |
697 | */ |
| 714 | ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) |
698 | ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct) |
| Line 749... | Line 733... | ||
| 749 | /** |
733 | /** |
| 750 | * @} |
734 | * @} |
| 751 | */ |
735 | */ |
| 752 | 736 | ||
| 753 | /** @addtogroup TIM_LL_Private_Functions TIM Private Functions |
737 | /** @addtogroup TIM_LL_Private_Functions TIM Private Functions |
| 754 | * @brief Private functions |
738 | * @brief Private functions |
| 755 | * @{ |
739 | * @{ |
| 756 | */ |
740 | */ |
| 757 | /** |
741 | /** |
| 758 | * @brief Configure the TIMx output channel 1. |
742 | * @brief Configure the TIMx output channel 1. |
| 759 | * @param TIMx Timer Instance |
743 | * @param TIMx Timer Instance |
| Line 762... | Line 746... | ||
| 762 | * - SUCCESS: TIMx registers are de-initialized |
746 | * - SUCCESS: TIMx registers are de-initialized |
| 763 | * - ERROR: not applicable |
747 | * - ERROR: not applicable |
| 764 | */ |
748 | */ |
| 765 | static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
749 | static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
| 766 | { |
750 | { |
| 767 | uint32_t tmpccmr1 = 0U; |
751 | uint32_t tmpccmr1; |
| 768 | uint32_t tmpccer = 0U; |
752 | uint32_t tmpccer; |
| 769 | uint32_t tmpcr2 = 0U; |
753 | uint32_t tmpcr2; |
| 770 | 754 | ||
| 771 | /* Check the parameters */ |
755 | /* Check the parameters */ |
| 772 | assert_param(IS_TIM_CC1_INSTANCE(TIMx)); |
756 | assert_param(IS_TIM_CC1_INSTANCE(TIMx)); |
| 773 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
757 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
| 774 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
758 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
| Line 841... | Line 825... | ||
| 841 | * - SUCCESS: TIMx registers are de-initialized |
825 | * - SUCCESS: TIMx registers are de-initialized |
| 842 | * - ERROR: not applicable |
826 | * - ERROR: not applicable |
| 843 | */ |
827 | */ |
| 844 | static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
828 | static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
| 845 | { |
829 | { |
| 846 | uint32_t tmpccmr1 = 0U; |
830 | uint32_t tmpccmr1; |
| 847 | uint32_t tmpccer = 0U; |
831 | uint32_t tmpccer; |
| 848 | uint32_t tmpcr2 = 0U; |
832 | uint32_t tmpcr2; |
| 849 | 833 | ||
| 850 | /* Check the parameters */ |
834 | /* Check the parameters */ |
| 851 | assert_param(IS_TIM_CC2_INSTANCE(TIMx)); |
835 | assert_param(IS_TIM_CC2_INSTANCE(TIMx)); |
| 852 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
836 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
| 853 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
837 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
| Line 920... | Line 904... | ||
| 920 | * - SUCCESS: TIMx registers are de-initialized |
904 | * - SUCCESS: TIMx registers are de-initialized |
| 921 | * - ERROR: not applicable |
905 | * - ERROR: not applicable |
| 922 | */ |
906 | */ |
| 923 | static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
907 | static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
| 924 | { |
908 | { |
| 925 | uint32_t tmpccmr2 = 0U; |
909 | uint32_t tmpccmr2; |
| 926 | uint32_t tmpccer = 0U; |
910 | uint32_t tmpccer; |
| 927 | uint32_t tmpcr2 = 0U; |
911 | uint32_t tmpcr2; |
| 928 | 912 | ||
| 929 | /* Check the parameters */ |
913 | /* Check the parameters */ |
| 930 | assert_param(IS_TIM_CC3_INSTANCE(TIMx)); |
914 | assert_param(IS_TIM_CC3_INSTANCE(TIMx)); |
| 931 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
915 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
| 932 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
916 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
| Line 999... | Line 983... | ||
| 999 | * - SUCCESS: TIMx registers are de-initialized |
983 | * - SUCCESS: TIMx registers are de-initialized |
| 1000 | * - ERROR: not applicable |
984 | * - ERROR: not applicable |
| 1001 | */ |
985 | */ |
| 1002 | static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
986 | static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct) |
| 1003 | { |
987 | { |
| 1004 | uint32_t tmpccmr2 = 0U; |
988 | uint32_t tmpccmr2; |
| 1005 | uint32_t tmpccer = 0U; |
989 | uint32_t tmpccer; |
| 1006 | uint32_t tmpcr2 = 0U; |
990 | uint32_t tmpcr2; |
| 1007 | 991 | ||
| 1008 | /* Check the parameters */ |
992 | /* Check the parameters */ |
| 1009 | assert_param(IS_TIM_CC4_INSTANCE(TIMx)); |
993 | assert_param(IS_TIM_CC4_INSTANCE(TIMx)); |
| 1010 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
994 | assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode)); |
| 1011 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |
995 | assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState)); |