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 Header file of TIM LL module. |
5 | * @brief Header file of TIM LL module. |
| 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 | 19 | ||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Line 46... | Line 30... | ||
| 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 | /** @defgroup TIM_LL TIM |
37 | /** @defgroup TIM_LL TIM |
| 54 | * @{ |
38 | * @{ |
| 55 | */ |
39 | */ |
| 56 | 40 | ||
| Line 115... | Line 99... | ||
| 115 | }; |
99 | }; |
| 116 | /** |
100 | /** |
| 117 | * @} |
101 | * @} |
| 118 | */ |
102 | */ |
| 119 | 103 | ||
| 120 | - | ||
| 121 | /* Private constants ---------------------------------------------------------*/ |
104 | /* Private constants ---------------------------------------------------------*/ |
| 122 | /** @defgroup TIM_LL_Private_Constants TIM Private Constants |
105 | /** @defgroup TIM_LL_Private_Constants TIM Private Constants |
| 123 | * @{ |
106 | * @{ |
| 124 | */ |
107 | */ |
| 125 | 108 | ||
| Line 156... | Line 139... | ||
| 156 | * @arg @ref LL_TIM_CHANNEL_CH3N |
139 | * @arg @ref LL_TIM_CHANNEL_CH3N |
| 157 | * @arg @ref LL_TIM_CHANNEL_CH4 |
140 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 158 | * @retval none |
141 | * @retval none |
| 159 | */ |
142 | */ |
| 160 | #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \ |
143 | #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \ |
| 161 | (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\ |
144 | (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\ |
| 162 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\ |
145 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\ |
| 163 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\ |
146 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\ |
| 164 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\ |
147 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\ |
| 165 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\ |
148 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\ |
| 166 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U) |
149 | ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U) |
| 167 | 150 | ||
| 168 | /** @brief Calculate the deadtime sampling period(in ps). |
151 | /** @brief Calculate the deadtime sampling period(in ps). |
| 169 | * @param __TIMCLK__ timer input clock frequency (in Hz). |
152 | * @param __TIMCLK__ timer input clock frequency (in Hz). |
| 170 | * @param __CKD__ This parameter can be one of the following values: |
153 | * @param __CKD__ This parameter can be one of the following values: |
| 171 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 |
154 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 |
| 172 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 |
155 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 |
| 173 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 |
156 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 |
| 174 | * @retval none |
157 | * @retval none |
| 175 | */ |
158 | */ |
| 176 | #define TIM_CALC_DTS(__TIMCLK__, __CKD__) \ |
159 | #define TIM_CALC_DTS(__TIMCLK__, __CKD__) \ |
| 177 | (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \ |
160 | (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \ |
| 178 | ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \ |
161 | ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \ |
| 179 | ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U))) |
162 | ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U))) |
| 180 | /** |
163 | /** |
| 181 | * @} |
164 | * @} |
| 182 | */ |
165 | */ |
| 183 | 166 | ||
| 184 | 167 | ||
| Line 213... | Line 196... | ||
| 213 | uint32_t ClockDivision; /*!< Specifies the clock division. |
196 | uint32_t ClockDivision; /*!< Specifies the clock division. |
| 214 | This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. |
197 | This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. |
| 215 | 198 | ||
| 216 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/ |
199 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/ |
| 217 | 200 | ||
| 218 | uint8_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter |
201 | uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter |
| 219 | reaches zero, an update event is generated and counting restarts |
202 | reaches zero, an update event is generated and counting restarts |
| 220 | from the RCR value (N). |
203 | from the RCR value (N). |
| 221 | This means in PWM mode that (N+1) corresponds to: |
204 | This means in PWM mode that (N+1) corresponds to: |
| 222 | - the number of PWM periods in edge-aligned mode |
205 | - the number of PWM periods in edge-aligned mode |
| 223 | - the number of half PWM period in center-aligned mode |
206 | - the number of half PWM period in center-aligned mode |
| 224 | This parameter must be a number between 0x00 and 0xFF. |
207 | GP timers: this parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. |
| - | 208 | Advanced timers: this parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. |
|
| 225 | 209 | ||
| 226 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetRepetitionCounter().*/ |
210 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetRepetitionCounter().*/ |
| 227 | } LL_TIM_InitTypeDef; |
211 | } LL_TIM_InitTypeDef; |
| 228 | 212 | ||
| 229 | /** |
213 | /** |
| Line 527... | Line 511... | ||
| 527 | /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode |
511 | /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode |
| 528 | * @{ |
512 | * @{ |
| 529 | */ |
513 | */ |
| 530 | #define LL_TIM_COUNTERMODE_UP 0x00000000U /*!<Counter used as upcounter */ |
514 | #define LL_TIM_COUNTERMODE_UP 0x00000000U /*!<Counter used as upcounter */ |
| 531 | #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */ |
515 | #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */ |
| 532 | #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. */ |
516 | #define LL_TIM_COUNTERMODE_CENTER_DOWN 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. */ |
| 533 | #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 */ |
517 | #define LL_TIM_COUNTERMODE_CENTER_UP 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 */ |
| 534 | #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. */ |
518 | #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. */ |
| 535 | /** |
519 | /** |
| 536 | * @} |
520 | * @} |
| 537 | */ |
521 | */ |
| 538 | 522 | ||
| Line 614... | Line 598... | ||
| 614 | */ |
598 | */ |
| 615 | #define LL_TIM_OCMODE_FROZEN 0x00000000U /*!<The comparison between the output compare register TIMx_CCRy and the counter TIMx_CNT has no effect on the output channel level */ |
599 | #define LL_TIM_OCMODE_FROZEN 0x00000000U /*!<The comparison between the output compare register TIMx_CCRy and the counter TIMx_CNT has no effect on the output channel level */ |
| 616 | #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/ |
600 | #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/ |
| 617 | #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/ |
601 | #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/ |
| 618 | #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/ |
602 | #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/ |
| 619 | #define LL_TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!<OCyREF is forced low*/ |
603 | #define LL_TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!<OCyREF is forced low*/ |
| 620 | #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/ |
604 | #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/ |
| 621 | #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.*/ |
605 | #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.*/ |
| 622 | #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*/ |
606 | #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*/ |
| 623 | /** |
607 | /** |
| 624 | * @} |
608 | * @} |
| Line 654... | Line 638... | ||
| 654 | */ |
638 | */ |
| 655 | 639 | ||
| 656 | /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler |
640 | /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler |
| 657 | * @{ |
641 | * @{ |
| 658 | */ |
642 | */ |
| 659 | #define LL_TIM_ICPSC_DIV1 0x00000000U /*!< No prescaler, capture is done each time an edge is detected on the capture input */ |
643 | #define LL_TIM_ICPSC_DIV1 0x00000000U /*!< No prescaler, capture is done each time an edge is detected on the capture input */ |
| 660 | #define LL_TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */ |
644 | #define LL_TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */ |
| 661 | #define LL_TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */ |
645 | #define LL_TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */ |
| 662 | #define LL_TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */ |
646 | #define LL_TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */ |
| 663 | /** |
647 | /** |
| 664 | * @} |
648 | * @} |
| Line 698... | Line 682... | ||
| 698 | 682 | ||
| 699 | /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source |
683 | /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source |
| 700 | * @{ |
684 | * @{ |
| 701 | */ |
685 | */ |
| 702 | #define LL_TIM_CLOCKSOURCE_INTERNAL 0x00000000U /*!< The timer is clocked by the internal clock provided from the RCC */ |
686 | #define LL_TIM_CLOCKSOURCE_INTERNAL 0x00000000U /*!< The timer is clocked by the internal clock provided from the RCC */ |
| 703 | #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*/ |
687 | #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 input*/ |
| 704 | #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */ |
688 | #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */ |
| 705 | /** |
689 | /** |
| 706 | * @} |
690 | * @} |
| 707 | */ |
691 | */ |
| 708 | 692 | ||
| 709 | /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode |
693 | /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode |
| 710 | * @{ |
694 | * @{ |
| 711 | */ |
695 | */ |
| 712 | #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Encoder mode 1 - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */ |
696 | #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Quadrature encoder mode 1, x2 mode - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */ |
| 713 | #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Encoder mode 2 - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */ |
697 | #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Quadrature encoder mode 2, x2 mode - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */ |
| 714 | #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 */ |
698 | #define LL_TIM_ENCODERMODE_X4_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode 3, x4 mode - Counter counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input */ |
| 715 | /** |
699 | /** |
| 716 | * @} |
700 | * @} |
| 717 | */ |
701 | */ |
| 718 | 702 | ||
| 719 | /** @defgroup TIM_LL_EC_TRGO Trigger Output |
703 | /** @defgroup TIM_LL_EC_TRGO Trigger Output |
| Line 744... | Line 728... | ||
| 744 | */ |
728 | */ |
| 745 | 729 | ||
| 746 | /** @defgroup TIM_LL_EC_TS Trigger Selection |
730 | /** @defgroup TIM_LL_EC_TS Trigger Selection |
| 747 | * @{ |
731 | * @{ |
| 748 | */ |
732 | */ |
| 749 | #define LL_TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) is used as trigger input */ |
733 | #define LL_TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) is used as trigger input */ |
| 750 | #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */ |
734 | #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */ |
| 751 | #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */ |
735 | #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */ |
| 752 | #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */ |
736 | #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */ |
| 753 | #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */ |
737 | #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */ |
| 754 | #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */ |
738 | #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */ |
| 755 | #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */ |
739 | #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */ |
| 756 | #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 */ |
740 | #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 */ |
| 757 | /** |
741 | /** |
| 758 | * @} |
742 | * @} |
| 759 | */ |
743 | */ |
| 760 | 744 | ||
| 761 | /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity |
745 | /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity |
| Line 882... | Line 866... | ||
| 882 | /** |
866 | /** |
| 883 | * @} |
867 | * @} |
| 884 | */ |
868 | */ |
| 885 | 869 | ||
| 886 | 870 | ||
| 887 | - | ||
| 888 | /** |
871 | /** |
| 889 | * @} |
872 | * @} |
| 890 | */ |
873 | */ |
| 891 | 874 | ||
| 892 | /* Exported macro ------------------------------------------------------------*/ |
875 | /* Exported macro ------------------------------------------------------------*/ |
| Line 902... | Line 885... | ||
| 902 | * @param __INSTANCE__ TIM Instance |
885 | * @param __INSTANCE__ TIM Instance |
| 903 | * @param __REG__ Register to be written |
886 | * @param __REG__ Register to be written |
| 904 | * @param __VALUE__ Value to be written in the register |
887 | * @param __VALUE__ Value to be written in the register |
| 905 | * @retval None |
888 | * @retval None |
| 906 | */ |
889 | */ |
| 907 | #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
890 | #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__)) |
| 908 | 891 | ||
| 909 | /** |
892 | /** |
| 910 | * @brief Read a value in TIM register. |
893 | * @brief Read a value in TIM register. |
| 911 | * @param __INSTANCE__ TIM Instance |
894 | * @param __INSTANCE__ TIM Instance |
| 912 | * @param __REG__ Register to be read |
895 | * @param __REG__ Register to be read |
| 913 | * @retval Register value |
896 | * @retval Register value |
| 914 | */ |
897 | */ |
| 915 | #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
898 | #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__) |
| 916 | /** |
899 | /** |
| 917 | * @} |
900 | * @} |
| 918 | */ |
901 | */ |
| 919 | 902 | ||
| 920 | /** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros |
903 | /** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros |
| Line 931... | Line 914... | ||
| 931 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 |
914 | * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 |
| 932 | * @param __DT__ deadtime duration (in ns) |
915 | * @param __DT__ deadtime duration (in ns) |
| 933 | * @retval DTG[0:7] |
916 | * @retval DTG[0:7] |
| 934 | */ |
917 | */ |
| 935 | #define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \ |
918 | #define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \ |
| 936 | ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \ |
919 | ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \ |
| 937 | (((uint64_t)((__DT__)*1000U)) < (64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\ |
920 | (((uint64_t)((__DT__)*1000U)) < ((64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\ |
| 938 | (((uint64_t)((__DT__)*1000U)) < (32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\ |
921 | (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\ |
| 939 | (((uint64_t)((__DT__)*1000U)) < (32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\ |
922 | (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\ |
| 940 | 0U) |
923 | 0U) |
| 941 | 924 | ||
| 942 | /** |
925 | /** |
| 943 | * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. |
926 | * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. |
| 944 | * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000); |
927 | * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000); |
| 945 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
928 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
| 946 | * @param __CNTCLK__ counter clock frequency (in Hz) |
929 | * @param __CNTCLK__ counter clock frequency (in Hz) |
| 947 | * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) |
930 | * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) |
| 948 | */ |
931 | */ |
| 949 | #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ |
932 | #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ |
| 950 | ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U |
933 | (((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)(((__TIMCLK__)/(__CNTCLK__)) - 1U) : 0U) |
| 951 | 934 | ||
| 952 | /** |
935 | /** |
| 953 | * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. |
936 | * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. |
| 954 | * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000); |
937 | * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000); |
| 955 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
938 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
| 956 | * @param __PSC__ prescaler |
939 | * @param __PSC__ prescaler |
| 957 | * @param __FREQ__ output signal frequency (in Hz) |
940 | * @param __FREQ__ output signal frequency (in Hz) |
| 958 | * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) |
941 | * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) |
| 959 | */ |
942 | */ |
| 960 | #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ |
943 | #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ |
| 961 | (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U |
944 | ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) |
| 962 | 945 | ||
| 963 | /** |
946 | /** |
| 964 | * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay. |
947 | * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay. |
| 965 | * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); |
948 | * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); |
| 966 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
949 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
| 967 | * @param __PSC__ prescaler |
950 | * @param __PSC__ prescaler |
| 968 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
951 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
| 969 | * @retval Compare value (between Min_Data=0 and Max_Data=65535) |
952 | * @retval Compare value (between Min_Data=0 and Max_Data=65535) |
| 970 | */ |
953 | */ |
| 971 | #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ |
954 | #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ |
| 972 | ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ |
955 | ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ |
| 973 | / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) |
956 | / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) |
| 974 | 957 | ||
| 975 | /** |
958 | /** |
| 976 | * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode). |
959 | * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode). |
| 977 | * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); |
960 | * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); |
| 978 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
961 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
| Line 980... | Line 963... | ||
| 980 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
963 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
| 981 | * @param __PULSE__ pulse duration (in us) |
964 | * @param __PULSE__ pulse duration (in us) |
| 982 | * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) |
965 | * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) |
| 983 | */ |
966 | */ |
| 984 | #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ |
967 | #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ |
| 985 | ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \ |
968 | ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \ |
| 986 | + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__)))) |
969 | + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__)))) |
| 987 | 970 | ||
| 988 | /** |
971 | /** |
| 989 | * @brief HELPER macro retrieving the ratio of the input capture prescaler |
972 | * @brief HELPER macro retrieving the ratio of the input capture prescaler |
| 990 | * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ()); |
973 | * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ()); |
| 991 | * @param __ICPSC__ This parameter can be one of the following values: |
974 | * @param __ICPSC__ This parameter can be one of the following values: |
| Line 994... | Line 977... | ||
| 994 | * @arg @ref LL_TIM_ICPSC_DIV4 |
977 | * @arg @ref LL_TIM_ICPSC_DIV4 |
| 995 | * @arg @ref LL_TIM_ICPSC_DIV8 |
978 | * @arg @ref LL_TIM_ICPSC_DIV8 |
| 996 | * @retval Input capture prescaler ratio (1, 2, 4 or 8) |
979 | * @retval Input capture prescaler ratio (1, 2, 4 or 8) |
| 997 | */ |
980 | */ |
| 998 | #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \ |
981 | #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \ |
| 999 | ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos))) |
982 | ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos))) |
| 1000 | 983 | ||
| 1001 | 984 | ||
| 1002 | /** |
985 | /** |
| 1003 | * @} |
986 | * @} |
| 1004 | */ |
987 | */ |
| Line 1044... | Line 1027... | ||
| 1044 | * @param TIMx Timer instance |
1027 | * @param TIMx Timer instance |
| 1045 | * @retval State of bit (1 or 0). |
1028 | * @retval State of bit (1 or 0). |
| 1046 | */ |
1029 | */ |
| 1047 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx) |
1030 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx) |
| 1048 | { |
1031 | { |
| 1049 | return (READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)); |
1032 | return ((READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL); |
| 1050 | } |
1033 | } |
| 1051 | 1034 | ||
| 1052 | /** |
1035 | /** |
| 1053 | * @brief Enable update event generation. |
1036 | * @brief Enable update event generation. |
| 1054 | * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent |
1037 | * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent |
| Line 1073... | Line 1056... | ||
| 1073 | 1056 | ||
| 1074 | /** |
1057 | /** |
| 1075 | * @brief Indicates whether update event generation is enabled. |
1058 | * @brief Indicates whether update event generation is enabled. |
| 1076 | * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent |
1059 | * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent |
| 1077 | * @param TIMx Timer instance |
1060 | * @param TIMx Timer instance |
| 1078 | * @retval State of bit (1 or 0). |
1061 | * @retval Inverted state of bit (0 or 1). |
| 1079 | */ |
1062 | */ |
| 1080 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx) |
1063 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx) |
| 1081 | { |
1064 | { |
| 1082 | return (READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (TIM_CR1_UDIS)); |
1065 | return ((READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (uint32_t)RESET) ? 1UL : 0UL); |
| 1083 | } |
1066 | } |
| 1084 | 1067 | ||
| 1085 | /** |
1068 | /** |
| 1086 | * @brief Set update event source |
1069 | * @brief Set update event source |
| 1087 | * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events |
1070 | * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events |
| Line 1143... | Line 1126... | ||
| 1143 | return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM)); |
1126 | return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM)); |
| 1144 | } |
1127 | } |
| 1145 | 1128 | ||
| 1146 | /** |
1129 | /** |
| 1147 | * @brief Set the timer counter counting mode. |
1130 | * @brief Set the timer counter counting mode. |
| 1148 | * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to |
1131 | * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to |
| 1149 | * check whether or not the counter mode selection feature is supported |
1132 | * check whether or not the counter mode selection feature is supported |
| 1150 | * by a timer instance. |
1133 | * by a timer instance. |
| 1151 | * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) |
1134 | * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) |
| 1152 | * requires a timer reset to avoid unexpected direction |
1135 | * requires a timer reset to avoid unexpected direction |
| 1153 | * due to DIR bit readonly in center aligned mode. |
1136 | * due to DIR bit readonly in center aligned mode. |
| Line 1162... | Line 1145... | ||
| 1162 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN |
1145 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN |
| 1163 | * @retval None |
1146 | * @retval None |
| 1164 | */ |
1147 | */ |
| 1165 | __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode) |
1148 | __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode) |
| 1166 | { |
1149 | { |
| 1167 | MODIFY_REG(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS, CounterMode); |
1150 | MODIFY_REG(TIMx->CR1, (TIM_CR1_DIR | TIM_CR1_CMS), CounterMode); |
| 1168 | } |
1151 | } |
| 1169 | 1152 | ||
| 1170 | /** |
1153 | /** |
| 1171 | * @brief Get actual counter mode. |
1154 | * @brief Get actual counter mode. |
| 1172 | * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to |
1155 | * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to |
| 1173 | * check whether or not the counter mode selection feature is supported |
1156 | * check whether or not the counter mode selection feature is supported |
| 1174 | * by a timer instance. |
1157 | * by a timer instance. |
| 1175 | * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n |
1158 | * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n |
| 1176 | * CR1 CMS LL_TIM_GetCounterMode |
1159 | * CR1 CMS LL_TIM_GetCounterMode |
| 1177 | * @param TIMx Timer instance |
1160 | * @param TIMx Timer instance |
| Line 1215... | Line 1198... | ||
| 1215 | * @param TIMx Timer instance |
1198 | * @param TIMx Timer instance |
| 1216 | * @retval State of bit (1 or 0). |
1199 | * @retval State of bit (1 or 0). |
| 1217 | */ |
1200 | */ |
| 1218 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx) |
1201 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx) |
| 1219 | { |
1202 | { |
| 1220 | return (READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)); |
1203 | return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); |
| 1221 | } |
1204 | } |
| 1222 | 1205 | ||
| 1223 | /** |
1206 | /** |
| 1224 | * @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. |
1207 | * @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. |
| 1225 | * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1208 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
| 1226 | * whether or not the clock division feature is supported by the timer |
1209 | * whether or not the clock division feature is supported by the timer |
| 1227 | * instance. |
1210 | * instance. |
| 1228 | * @rmtoll CR1 CKD LL_TIM_SetClockDivision |
1211 | * @rmtoll CR1 CKD LL_TIM_SetClockDivision |
| 1229 | * @param TIMx Timer instance |
1212 | * @param TIMx Timer instance |
| 1230 | * @param ClockDivision This parameter can be one of the following values: |
1213 | * @param ClockDivision This parameter can be one of the following values: |
| Line 1238... | Line 1221... | ||
| 1238 | MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); |
1221 | MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); |
| 1239 | } |
1222 | } |
| 1240 | 1223 | ||
| 1241 | /** |
1224 | /** |
| 1242 | * @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. |
1225 | * @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. |
| 1243 | * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1226 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
| 1244 | * whether or not the clock division feature is supported by the timer |
1227 | * whether or not the clock division feature is supported by the timer |
| 1245 | * instance. |
1228 | * instance. |
| 1246 | * @rmtoll CR1 CKD LL_TIM_GetClockDivision |
1229 | * @rmtoll CR1 CKD LL_TIM_GetClockDivision |
| 1247 | * @param TIMx Timer instance |
1230 | * @param TIMx Timer instance |
| 1248 | * @retval Returned value can be one of the following values: |
1231 | * @retval Returned value can be one of the following values: |
| Line 1343... | Line 1326... | ||
| 1343 | return (uint32_t)(READ_REG(TIMx->ARR)); |
1326 | return (uint32_t)(READ_REG(TIMx->ARR)); |
| 1344 | } |
1327 | } |
| 1345 | 1328 | ||
| 1346 | /** |
1329 | /** |
| 1347 | * @brief Set the repetition counter value. |
1330 | * @brief Set the repetition counter value. |
| 1348 | * @note Macro @ref IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check |
1331 | * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check |
| 1349 | * whether or not a timer instance supports a repetition counter. |
1332 | * whether or not a timer instance supports a repetition counter. |
| 1350 | * @rmtoll RCR REP LL_TIM_SetRepetitionCounter |
1333 | * @rmtoll RCR REP LL_TIM_SetRepetitionCounter |
| 1351 | * @param TIMx Timer instance |
1334 | * @param TIMx Timer instance |
| 1352 | * @param RepetitionCounter between Min_Data=0 and Max_Data=255 |
1335 | * @param RepetitionCounter between Min_Data=0 and Max_Data=255 or 65535 for advanced timer. |
| 1353 | * @retval None |
1336 | * @retval None |
| 1354 | */ |
1337 | */ |
| 1355 | __STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter) |
1338 | __STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter) |
| 1356 | { |
1339 | { |
| 1357 | WRITE_REG(TIMx->RCR, RepetitionCounter); |
1340 | WRITE_REG(TIMx->RCR, RepetitionCounter); |
| 1358 | } |
1341 | } |
| 1359 | 1342 | ||
| 1360 | /** |
1343 | /** |
| 1361 | * @brief Get the repetition counter value. |
1344 | * @brief Get the repetition counter value. |
| 1362 | * @note Macro @ref IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check |
1345 | * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check |
| 1363 | * whether or not a timer instance supports a repetition counter. |
1346 | * whether or not a timer instance supports a repetition counter. |
| 1364 | * @rmtoll RCR REP LL_TIM_GetRepetitionCounter |
1347 | * @rmtoll RCR REP LL_TIM_GetRepetitionCounter |
| 1365 | * @param TIMx Timer instance |
1348 | * @param TIMx Timer instance |
| 1366 | * @retval Repetition counter value |
1349 | * @retval Repetition counter value |
| 1367 | */ |
1350 | */ |
| Line 1380... | Line 1363... | ||
| 1380 | /** |
1363 | /** |
| 1381 | * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. |
1364 | * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. |
| 1382 | * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written, |
1365 | * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written, |
| 1383 | * they are updated only when a commutation event (COM) occurs. |
1366 | * they are updated only when a commutation event (COM) occurs. |
| 1384 | * @note Only on channels that have a complementary output. |
1367 | * @note Only on channels that have a complementary output. |
| 1385 | * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
1368 | * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
| 1386 | * whether or not a timer instance is able to generate a commutation event. |
1369 | * whether or not a timer instance is able to generate a commutation event. |
| 1387 | * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload |
1370 | * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload |
| 1388 | * @param TIMx Timer instance |
1371 | * @param TIMx Timer instance |
| 1389 | * @retval None |
1372 | * @retval None |
| 1390 | */ |
1373 | */ |
| Line 1393... | Line 1376... | ||
| 1393 | SET_BIT(TIMx->CR2, TIM_CR2_CCPC); |
1376 | SET_BIT(TIMx->CR2, TIM_CR2_CCPC); |
| 1394 | } |
1377 | } |
| 1395 | 1378 | ||
| 1396 | /** |
1379 | /** |
| 1397 | * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. |
1380 | * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. |
| 1398 | * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
1381 | * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
| 1399 | * whether or not a timer instance is able to generate a commutation event. |
1382 | * whether or not a timer instance is able to generate a commutation event. |
| 1400 | * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload |
1383 | * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload |
| 1401 | * @param TIMx Timer instance |
1384 | * @param TIMx Timer instance |
| 1402 | * @retval None |
1385 | * @retval None |
| 1403 | */ |
1386 | */ |
| Line 1406... | Line 1389... | ||
| 1406 | CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC); |
1389 | CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC); |
| 1407 | } |
1390 | } |
| 1408 | 1391 | ||
| 1409 | /** |
1392 | /** |
| 1410 | * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM). |
1393 | * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM). |
| 1411 | * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
1394 | * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check |
| 1412 | * whether or not a timer instance is able to generate a commutation event. |
1395 | * whether or not a timer instance is able to generate a commutation event. |
| 1413 | * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate |
1396 | * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate |
| 1414 | * @param TIMx Timer instance |
1397 | * @param TIMx Timer instance |
| 1415 | * @param CCUpdateSource This parameter can be one of the following values: |
1398 | * @param CCUpdateSource This parameter can be one of the following values: |
| 1416 | * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY |
1399 | * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY |
| Line 1450... | Line 1433... | ||
| 1450 | } |
1433 | } |
| 1451 | 1434 | ||
| 1452 | /** |
1435 | /** |
| 1453 | * @brief Set the lock level to freeze the |
1436 | * @brief Set the lock level to freeze the |
| 1454 | * configuration of several capture/compare parameters. |
1437 | * configuration of several capture/compare parameters. |
| 1455 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
1438 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 1456 | * the lock mechanism is supported by a timer instance. |
1439 | * the lock mechanism is supported by a timer instance. |
| 1457 | * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel |
1440 | * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel |
| 1458 | * @param TIMx Timer instance |
1441 | * @param TIMx Timer instance |
| 1459 | * @param LockLevel This parameter can be one of the following values: |
1442 | * @param LockLevel This parameter can be one of the following values: |
| 1460 | * @arg @ref LL_TIM_LOCKLEVEL_OFF |
1443 | * @arg @ref LL_TIM_LOCKLEVEL_OFF |
| Line 1538... | Line 1521... | ||
| 1538 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1521 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1539 | * @retval State of bit (1 or 0). |
1522 | * @retval State of bit (1 or 0). |
| 1540 | */ |
1523 | */ |
| 1541 | __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels) |
1524 | __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels) |
| 1542 | { |
1525 | { |
| 1543 | return (READ_BIT(TIMx->CCER, Channels) == (Channels)); |
1526 | return ((READ_BIT(TIMx->CCER, Channels) == (Channels)) ? 1UL : 0UL); |
| 1544 | } |
1527 | } |
| 1545 | 1528 | ||
| 1546 | /** |
1529 | /** |
| 1547 | * @} |
1530 | * @} |
| 1548 | */ |
1531 | */ |
| Line 1575... | Line 1558... | ||
| 1575 | * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH |
1558 | * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH |
| 1576 | * @retval None |
1559 | * @retval None |
| 1577 | */ |
1560 | */ |
| 1578 | __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
1561 | __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
| 1579 | { |
1562 | { |
| 1580 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1563 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1581 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1564 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1582 | CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); |
1565 | CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); |
| 1583 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), |
1566 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), |
| 1584 | (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); |
1567 | (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); |
| 1585 | MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), |
1568 | MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), |
| 1586 | (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]); |
1569 | (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]); |
| Line 1610... | Line 1593... | ||
| 1610 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1593 | * @arg @ref LL_TIM_OCMODE_PWM2 |
| 1611 | * @retval None |
1594 | * @retval None |
| 1612 | */ |
1595 | */ |
| 1613 | __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) |
1596 | __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) |
| 1614 | { |
1597 | { |
| 1615 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1598 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1616 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1599 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1617 | MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); |
1600 | MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); |
| 1618 | } |
1601 | } |
| 1619 | 1602 | ||
| 1620 | /** |
1603 | /** |
| 1621 | * @brief Get the output compare mode of an output channel. |
1604 | * @brief Get the output compare mode of an output channel. |
| Line 1639... | Line 1622... | ||
| 1639 | * @arg @ref LL_TIM_OCMODE_PWM1 |
1622 | * @arg @ref LL_TIM_OCMODE_PWM1 |
| 1640 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1623 | * @arg @ref LL_TIM_OCMODE_PWM2 |
| 1641 | */ |
1624 | */ |
| 1642 | __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) |
1625 | __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1643 | { |
1626 | { |
| 1644 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1627 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1645 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1628 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1646 | return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); |
1629 | return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); |
| 1647 | } |
1630 | } |
| 1648 | 1631 | ||
| 1649 | /** |
1632 | /** |
| 1650 | * @brief Set the polarity of an output channel. |
1633 | * @brief Set the polarity of an output channel. |
| Line 1669... | Line 1652... | ||
| 1669 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1652 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
| 1670 | * @retval None |
1653 | * @retval None |
| 1671 | */ |
1654 | */ |
| 1672 | __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) |
1655 | __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) |
| 1673 | { |
1656 | { |
| 1674 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1657 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1675 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); |
1658 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); |
| 1676 | } |
1659 | } |
| 1677 | 1660 | ||
| 1678 | /** |
1661 | /** |
| 1679 | * @brief Get the polarity of an output channel. |
1662 | * @brief Get the polarity of an output channel. |
| Line 1697... | Line 1680... | ||
| 1697 | * @arg @ref LL_TIM_OCPOLARITY_HIGH |
1680 | * @arg @ref LL_TIM_OCPOLARITY_HIGH |
| 1698 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1681 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
| 1699 | */ |
1682 | */ |
| 1700 | __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
1683 | __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1701 | { |
1684 | { |
| 1702 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1685 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1703 | return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); |
1686 | return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); |
| 1704 | } |
1687 | } |
| 1705 | 1688 | ||
| 1706 | /** |
1689 | /** |
| 1707 | * @brief Set the IDLE state of an output channel |
1690 | * @brief Set the IDLE state of an output channel |
| 1708 | * @note This function is significant only for the timer instances |
1691 | * @note This function is significant only for the timer instances |
| 1709 | * supporting the break feature. Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) |
1692 | * supporting the break feature. Macro IS_TIM_BREAK_INSTANCE(TIMx) |
| 1710 | * can be used to check whether or not a timer instance provides |
1693 | * can be used to check whether or not a timer instance provides |
| 1711 | * a break input. |
1694 | * a break input. |
| 1712 | * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n |
1695 | * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n |
| 1713 | * CR2 OIS1N LL_TIM_OC_SetIdleState\n |
1696 | * CR2 OIS1N LL_TIM_OC_SetIdleState\n |
| 1714 | * CR2 OIS2 LL_TIM_OC_SetIdleState\n |
1697 | * CR2 OIS2 LL_TIM_OC_SetIdleState\n |
| Line 1730... | Line 1713... | ||
| 1730 | * @arg @ref LL_TIM_OCIDLESTATE_HIGH |
1713 | * @arg @ref LL_TIM_OCIDLESTATE_HIGH |
| 1731 | * @retval None |
1714 | * @retval None |
| 1732 | */ |
1715 | */ |
| 1733 | __STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState) |
1716 | __STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState) |
| 1734 | { |
1717 | { |
| 1735 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1718 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1736 | MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]); |
1719 | MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]); |
| 1737 | } |
1720 | } |
| 1738 | 1721 | ||
| 1739 | /** |
1722 | /** |
| 1740 | * @brief Get the IDLE state of an output channel |
1723 | * @brief Get the IDLE state of an output channel |
| Line 1758... | Line 1741... | ||
| 1758 | * @arg @ref LL_TIM_OCIDLESTATE_LOW |
1741 | * @arg @ref LL_TIM_OCIDLESTATE_LOW |
| 1759 | * @arg @ref LL_TIM_OCIDLESTATE_HIGH |
1742 | * @arg @ref LL_TIM_OCIDLESTATE_HIGH |
| 1760 | */ |
1743 | */ |
| 1761 | __STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel) |
1744 | __STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1762 | { |
1745 | { |
| 1763 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1746 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1764 | return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]); |
1747 | return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]); |
| 1765 | } |
1748 | } |
| 1766 | 1749 | ||
| 1767 | /** |
1750 | /** |
| 1768 | * @brief Enable fast mode for the output channel. |
1751 | * @brief Enable fast mode for the output channel. |
| Line 1779... | Line 1762... | ||
| 1779 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1762 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1780 | * @retval None |
1763 | * @retval None |
| 1781 | */ |
1764 | */ |
| 1782 | __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1765 | __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1783 | { |
1766 | { |
| 1784 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1767 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1785 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1768 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1786 | SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1769 | SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
| 1787 | 1770 | ||
| 1788 | } |
1771 | } |
| 1789 | 1772 | ||
| 1790 | /** |
1773 | /** |
| Line 1801... | Line 1784... | ||
| 1801 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1784 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1802 | * @retval None |
1785 | * @retval None |
| 1803 | */ |
1786 | */ |
| 1804 | __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1787 | __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1805 | { |
1788 | { |
| 1806 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1789 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1807 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1790 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1808 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1791 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
| 1809 | 1792 | ||
| 1810 | } |
1793 | } |
| 1811 | 1794 | ||
| 1812 | /** |
1795 | /** |
| Line 1823... | Line 1806... | ||
| 1823 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1806 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1824 | * @retval State of bit (1 or 0). |
1807 | * @retval State of bit (1 or 0). |
| 1825 | */ |
1808 | */ |
| 1826 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1809 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1827 | { |
1810 | { |
| 1828 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1811 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1829 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1812 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1830 | register uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; |
1813 | uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; |
| 1831 | return (READ_BIT(*pReg, bitfield) == bitfield); |
1814 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
| 1832 | } |
1815 | } |
| 1833 | 1816 | ||
| 1834 | /** |
1817 | /** |
| 1835 | * @brief Enable compare register (TIMx_CCRx) preload for the output channel. |
1818 | * @brief Enable compare register (TIMx_CCRx) preload for the output channel. |
| 1836 | * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n |
1819 | * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n |
| Line 1845... | Line 1828... | ||
| 1845 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1828 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1846 | * @retval None |
1829 | * @retval None |
| 1847 | */ |
1830 | */ |
| 1848 | __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1831 | __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1849 | { |
1832 | { |
| 1850 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1833 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1851 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1834 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1852 | SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1835 | SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
| 1853 | } |
1836 | } |
| 1854 | 1837 | ||
| 1855 | /** |
1838 | /** |
| 1856 | * @brief Disable compare register (TIMx_CCRx) preload for the output channel. |
1839 | * @brief Disable compare register (TIMx_CCRx) preload for the output channel. |
| Line 1866... | Line 1849... | ||
| 1866 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1849 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1867 | * @retval None |
1850 | * @retval None |
| 1868 | */ |
1851 | */ |
| 1869 | __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1852 | __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1870 | { |
1853 | { |
| 1871 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1854 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1872 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1855 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1873 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1856 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
| 1874 | } |
1857 | } |
| 1875 | 1858 | ||
| 1876 | /** |
1859 | /** |
| 1877 | * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. |
1860 | * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. |
| Line 1887... | Line 1870... | ||
| 1887 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1870 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1888 | * @retval State of bit (1 or 0). |
1871 | * @retval State of bit (1 or 0). |
| 1889 | */ |
1872 | */ |
| 1890 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1873 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1891 | { |
1874 | { |
| 1892 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1875 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1893 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1876 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1894 | register uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; |
1877 | uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; |
| 1895 | return (READ_BIT(*pReg, bitfield) == bitfield); |
1878 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
| 1896 | } |
1879 | } |
| 1897 | 1880 | ||
| 1898 | /** |
1881 | /** |
| 1899 | * @brief Enable clearing the output channel on an external event. |
1882 | * @brief Enable clearing the output channel on an external event. |
| 1900 | * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. |
1883 | * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. |
| 1901 | * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
1884 | * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
| 1902 | * or not a timer instance can clear the OCxREF signal on an external event. |
1885 | * or not a timer instance can clear the OCxREF signal on an external event. |
| 1903 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n |
1886 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n |
| 1904 | * CCMR1 OC2CE LL_TIM_OC_EnableClear\n |
1887 | * CCMR1 OC2CE LL_TIM_OC_EnableClear\n |
| 1905 | * CCMR2 OC3CE LL_TIM_OC_EnableClear\n |
1888 | * CCMR2 OC3CE LL_TIM_OC_EnableClear\n |
| 1906 | * CCMR2 OC4CE LL_TIM_OC_EnableClear |
1889 | * CCMR2 OC4CE LL_TIM_OC_EnableClear |
| Line 1912... | Line 1895... | ||
| 1912 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1895 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1913 | * @retval None |
1896 | * @retval None |
| 1914 | */ |
1897 | */ |
| 1915 | __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1898 | __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1916 | { |
1899 | { |
| 1917 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1900 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1918 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1901 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1919 | SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1902 | SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
| 1920 | } |
1903 | } |
| 1921 | 1904 | ||
| 1922 | /** |
1905 | /** |
| 1923 | * @brief Disable clearing the output channel on an external event. |
1906 | * @brief Disable clearing the output channel on an external event. |
| 1924 | * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
1907 | * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
| 1925 | * or not a timer instance can clear the OCxREF signal on an external event. |
1908 | * or not a timer instance can clear the OCxREF signal on an external event. |
| 1926 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n |
1909 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n |
| 1927 | * CCMR1 OC2CE LL_TIM_OC_DisableClear\n |
1910 | * CCMR1 OC2CE LL_TIM_OC_DisableClear\n |
| 1928 | * CCMR2 OC3CE LL_TIM_OC_DisableClear\n |
1911 | * CCMR2 OC3CE LL_TIM_OC_DisableClear\n |
| 1929 | * CCMR2 OC4CE LL_TIM_OC_DisableClear |
1912 | * CCMR2 OC4CE LL_TIM_OC_DisableClear |
| Line 1935... | Line 1918... | ||
| 1935 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1918 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1936 | * @retval None |
1919 | * @retval None |
| 1937 | */ |
1920 | */ |
| 1938 | __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1921 | __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1939 | { |
1922 | { |
| 1940 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1923 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1941 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1924 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1942 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1925 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
| 1943 | } |
1926 | } |
| 1944 | 1927 | ||
| 1945 | /** |
1928 | /** |
| 1946 | * @brief Indicates clearing the output channel on an external event is enabled for the output channel. |
1929 | * @brief Indicates clearing the output channel on an external event is enabled for the output channel. |
| 1947 | * @note This function enables clearing the output channel on an external event. |
1930 | * @note This function enables clearing the output channel on an external event. |
| 1948 | * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. |
1931 | * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. |
| 1949 | * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
1932 | * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether |
| 1950 | * or not a timer instance can clear the OCxREF signal on an external event. |
1933 | * or not a timer instance can clear the OCxREF signal on an external event. |
| 1951 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n |
1934 | * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n |
| 1952 | * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n |
1935 | * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n |
| 1953 | * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n |
1936 | * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n |
| 1954 | * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n |
1937 | * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n |
| Line 1960... | Line 1943... | ||
| 1960 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1943 | * @arg @ref LL_TIM_CHANNEL_CH4 |
| 1961 | * @retval State of bit (1 or 0). |
1944 | * @retval State of bit (1 or 0). |
| 1962 | */ |
1945 | */ |
| 1963 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1946 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) |
| 1964 | { |
1947 | { |
| 1965 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1948 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 1966 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1949 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 1967 | register uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; |
1950 | uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; |
| 1968 | return (READ_BIT(*pReg, bitfield) == bitfield); |
1951 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
| 1969 | } |
1952 | } |
| 1970 | 1953 | ||
| 1971 | /** |
1954 | /** |
| 1972 | * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge if the Ocx and OCxN signals). |
1955 | * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge of the Ocx and OCxN signals). |
| 1973 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
1956 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 1974 | * dead-time insertion feature is supported by a timer instance. |
1957 | * dead-time insertion feature is supported by a timer instance. |
| 1975 | * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter |
1958 | * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter |
| 1976 | * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime |
1959 | * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime |
| 1977 | * @param TIMx Timer instance |
1960 | * @param TIMx Timer instance |
| 1978 | * @param DeadTime between Min_Data=0 and Max_Data=255 |
1961 | * @param DeadTime between Min_Data=0 and Max_Data=255 |
| Line 1983... | Line 1966... | ||
| 1983 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime); |
1966 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime); |
| 1984 | } |
1967 | } |
| 1985 | 1968 | ||
| 1986 | /** |
1969 | /** |
| 1987 | * @brief Set compare value for output channel 1 (TIMx_CCR1). |
1970 | * @brief Set compare value for output channel 1 (TIMx_CCR1). |
| 1988 | * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
1971 | * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
| 1989 | * output channel 1 is supported by a timer instance. |
1972 | * output channel 1 is supported by a timer instance. |
| 1990 | * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1 |
1973 | * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1 |
| 1991 | * @param TIMx Timer instance |
1974 | * @param TIMx Timer instance |
| 1992 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
1975 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
| 1993 | * @retval None |
1976 | * @retval None |
| Line 1997... | Line 1980... | ||
| 1997 | WRITE_REG(TIMx->CCR1, CompareValue); |
1980 | WRITE_REG(TIMx->CCR1, CompareValue); |
| 1998 | } |
1981 | } |
| 1999 | 1982 | ||
| 2000 | /** |
1983 | /** |
| 2001 | * @brief Set compare value for output channel 2 (TIMx_CCR2). |
1984 | * @brief Set compare value for output channel 2 (TIMx_CCR2). |
| 2002 | * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
1985 | * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
| 2003 | * output channel 2 is supported by a timer instance. |
1986 | * output channel 2 is supported by a timer instance. |
| 2004 | * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2 |
1987 | * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2 |
| 2005 | * @param TIMx Timer instance |
1988 | * @param TIMx Timer instance |
| 2006 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
1989 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
| 2007 | * @retval None |
1990 | * @retval None |
| Line 2011... | Line 1994... | ||
| 2011 | WRITE_REG(TIMx->CCR2, CompareValue); |
1994 | WRITE_REG(TIMx->CCR2, CompareValue); |
| 2012 | } |
1995 | } |
| 2013 | 1996 | ||
| 2014 | /** |
1997 | /** |
| 2015 | * @brief Set compare value for output channel 3 (TIMx_CCR3). |
1998 | * @brief Set compare value for output channel 3 (TIMx_CCR3). |
| 2016 | * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
1999 | * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
| 2017 | * output channel is supported by a timer instance. |
2000 | * output channel is supported by a timer instance. |
| 2018 | * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3 |
2001 | * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3 |
| 2019 | * @param TIMx Timer instance |
2002 | * @param TIMx Timer instance |
| 2020 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
2003 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
| 2021 | * @retval None |
2004 | * @retval None |
| Line 2025... | Line 2008... | ||
| 2025 | WRITE_REG(TIMx->CCR3, CompareValue); |
2008 | WRITE_REG(TIMx->CCR3, CompareValue); |
| 2026 | } |
2009 | } |
| 2027 | 2010 | ||
| 2028 | /** |
2011 | /** |
| 2029 | * @brief Set compare value for output channel 4 (TIMx_CCR4). |
2012 | * @brief Set compare value for output channel 4 (TIMx_CCR4). |
| 2030 | * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
2013 | * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
| 2031 | * output channel 4 is supported by a timer instance. |
2014 | * output channel 4 is supported by a timer instance. |
| 2032 | * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4 |
2015 | * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4 |
| 2033 | * @param TIMx Timer instance |
2016 | * @param TIMx Timer instance |
| 2034 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
2017 | * @param CompareValue between Min_Data=0 and Max_Data=65535 |
| 2035 | * @retval None |
2018 | * @retval None |
| Line 2039... | Line 2022... | ||
| 2039 | WRITE_REG(TIMx->CCR4, CompareValue); |
2022 | WRITE_REG(TIMx->CCR4, CompareValue); |
| 2040 | } |
2023 | } |
| 2041 | 2024 | ||
| 2042 | /** |
2025 | /** |
| 2043 | * @brief Get compare value (TIMx_CCR1) set for output channel 1. |
2026 | * @brief Get compare value (TIMx_CCR1) set for output channel 1. |
| 2044 | * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
2027 | * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
| 2045 | * output channel 1 is supported by a timer instance. |
2028 | * output channel 1 is supported by a timer instance. |
| 2046 | * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1 |
2029 | * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1 |
| 2047 | * @param TIMx Timer instance |
2030 | * @param TIMx Timer instance |
| 2048 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
2031 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
| 2049 | */ |
2032 | */ |
| Line 2052... | Line 2035... | ||
| 2052 | return (uint32_t)(READ_REG(TIMx->CCR1)); |
2035 | return (uint32_t)(READ_REG(TIMx->CCR1)); |
| 2053 | } |
2036 | } |
| 2054 | 2037 | ||
| 2055 | /** |
2038 | /** |
| 2056 | * @brief Get compare value (TIMx_CCR2) set for output channel 2. |
2039 | * @brief Get compare value (TIMx_CCR2) set for output channel 2. |
| 2057 | * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
2040 | * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
| 2058 | * output channel 2 is supported by a timer instance. |
2041 | * output channel 2 is supported by a timer instance. |
| 2059 | * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2 |
2042 | * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2 |
| 2060 | * @param TIMx Timer instance |
2043 | * @param TIMx Timer instance |
| 2061 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
2044 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
| 2062 | */ |
2045 | */ |
| Line 2065... | Line 2048... | ||
| 2065 | return (uint32_t)(READ_REG(TIMx->CCR2)); |
2048 | return (uint32_t)(READ_REG(TIMx->CCR2)); |
| 2066 | } |
2049 | } |
| 2067 | 2050 | ||
| 2068 | /** |
2051 | /** |
| 2069 | * @brief Get compare value (TIMx_CCR3) set for output channel 3. |
2052 | * @brief Get compare value (TIMx_CCR3) set for output channel 3. |
| 2070 | * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
2053 | * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
| 2071 | * output channel 3 is supported by a timer instance. |
2054 | * output channel 3 is supported by a timer instance. |
| 2072 | * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3 |
2055 | * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3 |
| 2073 | * @param TIMx Timer instance |
2056 | * @param TIMx Timer instance |
| 2074 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
2057 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
| 2075 | */ |
2058 | */ |
| Line 2078... | Line 2061... | ||
| 2078 | return (uint32_t)(READ_REG(TIMx->CCR3)); |
2061 | return (uint32_t)(READ_REG(TIMx->CCR3)); |
| 2079 | } |
2062 | } |
| 2080 | 2063 | ||
| 2081 | /** |
2064 | /** |
| 2082 | * @brief Get compare value (TIMx_CCR4) set for output channel 4. |
2065 | * @brief Get compare value (TIMx_CCR4) set for output channel 4. |
| 2083 | * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
2066 | * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
| 2084 | * output channel 4 is supported by a timer instance. |
2067 | * output channel 4 is supported by a timer instance. |
| 2085 | * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4 |
2068 | * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4 |
| 2086 | * @param TIMx Timer instance |
2069 | * @param TIMx Timer instance |
| 2087 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
2070 | * @retval CompareValue (between Min_Data=0 and Max_Data=65535) |
| 2088 | */ |
2071 | */ |
| Line 2132... | Line 2115... | ||
| 2132 | * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING |
2115 | * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING |
| 2133 | * @retval None |
2116 | * @retval None |
| 2134 | */ |
2117 | */ |
| 2135 | __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
2118 | __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
| 2136 | { |
2119 | { |
| 2137 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2120 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2138 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2121 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2139 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), |
2122 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), |
| 2140 | ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]); |
2123 | ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]); |
| 2141 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
2124 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
| 2142 | (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); |
2125 | (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); |
| 2143 | } |
2126 | } |
| Line 2160... | Line 2143... | ||
| 2160 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
2143 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
| 2161 | * @retval None |
2144 | * @retval None |
| 2162 | */ |
2145 | */ |
| 2163 | __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) |
2146 | __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) |
| 2164 | { |
2147 | { |
| 2165 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2148 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2166 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2149 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2167 | MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
2150 | MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
| 2168 | } |
2151 | } |
| 2169 | 2152 | ||
| 2170 | /** |
2153 | /** |
| 2171 | * @brief Get the current active input. |
2154 | * @brief Get the current active input. |
| Line 2184... | Line 2167... | ||
| 2184 | * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI |
2167 | * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI |
| 2185 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
2168 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
| 2186 | */ |
2169 | */ |
| 2187 | __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) |
2170 | __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) |
| 2188 | { |
2171 | { |
| 2189 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2172 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2190 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2173 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2191 | return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
2174 | return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
| 2192 | } |
2175 | } |
| 2193 | 2176 | ||
| 2194 | /** |
2177 | /** |
| 2195 | * @brief Set the prescaler of input channel. |
2178 | * @brief Set the prescaler of input channel. |
| Line 2210... | Line 2193... | ||
| 2210 | * @arg @ref LL_TIM_ICPSC_DIV8 |
2193 | * @arg @ref LL_TIM_ICPSC_DIV8 |
| 2211 | * @retval None |
2194 | * @retval None |
| 2212 | */ |
2195 | */ |
| 2213 | __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) |
2196 | __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) |
| 2214 | { |
2197 | { |
| 2215 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2198 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2216 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2199 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2217 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
2200 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
| 2218 | } |
2201 | } |
| 2219 | 2202 | ||
| 2220 | /** |
2203 | /** |
| 2221 | * @brief Get the current prescaler value acting on an input channel. |
2204 | * @brief Get the current prescaler value acting on an input channel. |
| Line 2235... | Line 2218... | ||
| 2235 | * @arg @ref LL_TIM_ICPSC_DIV4 |
2218 | * @arg @ref LL_TIM_ICPSC_DIV4 |
| 2236 | * @arg @ref LL_TIM_ICPSC_DIV8 |
2219 | * @arg @ref LL_TIM_ICPSC_DIV8 |
| 2237 | */ |
2220 | */ |
| 2238 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) |
2221 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) |
| 2239 | { |
2222 | { |
| 2240 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2223 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2241 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2224 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2242 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
2225 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
| 2243 | } |
2226 | } |
| 2244 | 2227 | ||
| 2245 | /** |
2228 | /** |
| 2246 | * @brief Set the input filter duration. |
2229 | * @brief Set the input filter duration. |
| Line 2273... | Line 2256... | ||
| 2273 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
2256 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
| 2274 | * @retval None |
2257 | * @retval None |
| 2275 | */ |
2258 | */ |
| 2276 | __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) |
2259 | __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) |
| 2277 | { |
2260 | { |
| 2278 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2261 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2279 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2262 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2280 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
2263 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
| 2281 | } |
2264 | } |
| 2282 | 2265 | ||
| 2283 | /** |
2266 | /** |
| 2284 | * @brief Get the input filter duration. |
2267 | * @brief Get the input filter duration. |
| Line 2310... | Line 2293... | ||
| 2310 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 |
2293 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 |
| 2311 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
2294 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
| 2312 | */ |
2295 | */ |
| 2313 | __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) |
2296 | __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) |
| 2314 | { |
2297 | { |
| 2315 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2298 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2316 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2299 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
| 2317 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
2300 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
| 2318 | } |
2301 | } |
| 2319 | 2302 | ||
| 2320 | /** |
2303 | /** |
| 2321 | * @brief Set the input channel polarity. |
2304 | * @brief Set the input channel polarity. |
| Line 2337... | Line 2320... | ||
| 2337 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
2320 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
| 2338 | * @retval None |
2321 | * @retval None |
| 2339 | */ |
2322 | */ |
| 2340 | __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) |
2323 | __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) |
| 2341 | { |
2324 | { |
| 2342 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2325 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2343 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
2326 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
| 2344 | ICPolarity << SHIFT_TAB_CCxP[iChannel]); |
2327 | ICPolarity << SHIFT_TAB_CCxP[iChannel]); |
| 2345 | } |
2328 | } |
| 2346 | 2329 | ||
| 2347 | /** |
2330 | /** |
| Line 2363... | Line 2346... | ||
| 2363 | * @arg @ref LL_TIM_IC_POLARITY_RISING |
2346 | * @arg @ref LL_TIM_IC_POLARITY_RISING |
| 2364 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
2347 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
| 2365 | */ |
2348 | */ |
| 2366 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
2349 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
| 2367 | { |
2350 | { |
| 2368 | register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2351 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
| 2369 | return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> |
2352 | return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> |
| 2370 | SHIFT_TAB_CCxP[iChannel]); |
2353 | SHIFT_TAB_CCxP[iChannel]); |
| 2371 | } |
2354 | } |
| 2372 | 2355 | ||
| 2373 | /** |
2356 | /** |
| 2374 | * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination). |
2357 | * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination). |
| 2375 | * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
2358 | * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
| 2376 | * a timer instance provides an XOR input. |
2359 | * a timer instance provides an XOR input. |
| 2377 | * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination |
2360 | * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination |
| 2378 | * @param TIMx Timer instance |
2361 | * @param TIMx Timer instance |
| 2379 | * @retval None |
2362 | * @retval None |
| 2380 | */ |
2363 | */ |
| Line 2383... | Line 2366... | ||
| 2383 | SET_BIT(TIMx->CR2, TIM_CR2_TI1S); |
2366 | SET_BIT(TIMx->CR2, TIM_CR2_TI1S); |
| 2384 | } |
2367 | } |
| 2385 | 2368 | ||
| 2386 | /** |
2369 | /** |
| 2387 | * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input. |
2370 | * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input. |
| 2388 | * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
2371 | * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
| 2389 | * a timer instance provides an XOR input. |
2372 | * a timer instance provides an XOR input. |
| 2390 | * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination |
2373 | * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination |
| 2391 | * @param TIMx Timer instance |
2374 | * @param TIMx Timer instance |
| 2392 | * @retval None |
2375 | * @retval None |
| 2393 | */ |
2376 | */ |
| Line 2396... | Line 2379... | ||
| 2396 | CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S); |
2379 | CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S); |
| 2397 | } |
2380 | } |
| 2398 | 2381 | ||
| 2399 | /** |
2382 | /** |
| 2400 | * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input. |
2383 | * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input. |
| 2401 | * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
2384 | * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not |
| 2402 | * a timer instance provides an XOR input. |
2385 | * a timer instance provides an XOR input. |
| 2403 | * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination |
2386 | * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination |
| 2404 | * @param TIMx Timer instance |
2387 | * @param TIMx Timer instance |
| 2405 | * @retval State of bit (1 or 0). |
2388 | * @retval State of bit (1 or 0). |
| 2406 | */ |
2389 | */ |
| 2407 | __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx) |
2390 | __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx) |
| 2408 | { |
2391 | { |
| 2409 | return (READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)); |
2392 | return ((READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)) ? 1UL : 0UL); |
| 2410 | } |
2393 | } |
| 2411 | 2394 | ||
| 2412 | /** |
2395 | /** |
| 2413 | * @brief Get captured value for input channel 1. |
2396 | * @brief Get captured value for input channel 1. |
| 2414 | * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
2397 | * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not |
| 2415 | * input channel 1 is supported by a timer instance. |
2398 | * input channel 1 is supported by a timer instance. |
| 2416 | * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1 |
2399 | * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1 |
| 2417 | * @param TIMx Timer instance |
2400 | * @param TIMx Timer instance |
| 2418 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
2401 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
| 2419 | */ |
2402 | */ |
| Line 2422... | Line 2405... | ||
| 2422 | return (uint32_t)(READ_REG(TIMx->CCR1)); |
2405 | return (uint32_t)(READ_REG(TIMx->CCR1)); |
| 2423 | } |
2406 | } |
| 2424 | 2407 | ||
| 2425 | /** |
2408 | /** |
| 2426 | * @brief Get captured value for input channel 2. |
2409 | * @brief Get captured value for input channel 2. |
| 2427 | * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
2410 | * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not |
| 2428 | * input channel 2 is supported by a timer instance. |
2411 | * input channel 2 is supported by a timer instance. |
| 2429 | * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2 |
2412 | * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2 |
| 2430 | * @param TIMx Timer instance |
2413 | * @param TIMx Timer instance |
| 2431 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
2414 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
| 2432 | */ |
2415 | */ |
| Line 2435... | Line 2418... | ||
| 2435 | return (uint32_t)(READ_REG(TIMx->CCR2)); |
2418 | return (uint32_t)(READ_REG(TIMx->CCR2)); |
| 2436 | } |
2419 | } |
| 2437 | 2420 | ||
| 2438 | /** |
2421 | /** |
| 2439 | * @brief Get captured value for input channel 3. |
2422 | * @brief Get captured value for input channel 3. |
| 2440 | * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
2423 | * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not |
| 2441 | * input channel 3 is supported by a timer instance. |
2424 | * input channel 3 is supported by a timer instance. |
| 2442 | * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3 |
2425 | * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3 |
| 2443 | * @param TIMx Timer instance |
2426 | * @param TIMx Timer instance |
| 2444 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
2427 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
| 2445 | */ |
2428 | */ |
| Line 2448... | Line 2431... | ||
| 2448 | return (uint32_t)(READ_REG(TIMx->CCR3)); |
2431 | return (uint32_t)(READ_REG(TIMx->CCR3)); |
| 2449 | } |
2432 | } |
| 2450 | 2433 | ||
| 2451 | /** |
2434 | /** |
| 2452 | * @brief Get captured value for input channel 4. |
2435 | * @brief Get captured value for input channel 4. |
| 2453 | * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
2436 | * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not |
| 2454 | * input channel 4 is supported by a timer instance. |
2437 | * input channel 4 is supported by a timer instance. |
| 2455 | * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4 |
2438 | * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4 |
| 2456 | * @param TIMx Timer instance |
2439 | * @param TIMx Timer instance |
| 2457 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
2440 | * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) |
| 2458 | */ |
2441 | */ |
| Line 2469... | Line 2452... | ||
| 2469 | * @{ |
2452 | * @{ |
| 2470 | */ |
2453 | */ |
| 2471 | /** |
2454 | /** |
| 2472 | * @brief Enable external clock mode 2. |
2455 | * @brief Enable external clock mode 2. |
| 2473 | * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal. |
2456 | * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal. |
| 2474 | * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
2457 | * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
| 2475 | * whether or not a timer instance supports external clock mode2. |
2458 | * whether or not a timer instance supports external clock mode2. |
| 2476 | * @rmtoll SMCR ECE LL_TIM_EnableExternalClock |
2459 | * @rmtoll SMCR ECE LL_TIM_EnableExternalClock |
| 2477 | * @param TIMx Timer instance |
2460 | * @param TIMx Timer instance |
| 2478 | * @retval None |
2461 | * @retval None |
| 2479 | */ |
2462 | */ |
| Line 2482... | Line 2465... | ||
| 2482 | SET_BIT(TIMx->SMCR, TIM_SMCR_ECE); |
2465 | SET_BIT(TIMx->SMCR, TIM_SMCR_ECE); |
| 2483 | } |
2466 | } |
| 2484 | 2467 | ||
| 2485 | /** |
2468 | /** |
| 2486 | * @brief Disable external clock mode 2. |
2469 | * @brief Disable external clock mode 2. |
| 2487 | * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
2470 | * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
| 2488 | * whether or not a timer instance supports external clock mode2. |
2471 | * whether or not a timer instance supports external clock mode2. |
| 2489 | * @rmtoll SMCR ECE LL_TIM_DisableExternalClock |
2472 | * @rmtoll SMCR ECE LL_TIM_DisableExternalClock |
| 2490 | * @param TIMx Timer instance |
2473 | * @param TIMx Timer instance |
| 2491 | * @retval None |
2474 | * @retval None |
| 2492 | */ |
2475 | */ |
| Line 2495... | Line 2478... | ||
| 2495 | CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE); |
2478 | CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE); |
| 2496 | } |
2479 | } |
| 2497 | 2480 | ||
| 2498 | /** |
2481 | /** |
| 2499 | * @brief Indicate whether external clock mode 2 is enabled. |
2482 | * @brief Indicate whether external clock mode 2 is enabled. |
| 2500 | * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
2483 | * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
| 2501 | * whether or not a timer instance supports external clock mode2. |
2484 | * whether or not a timer instance supports external clock mode2. |
| 2502 | * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock |
2485 | * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock |
| 2503 | * @param TIMx Timer instance |
2486 | * @param TIMx Timer instance |
| 2504 | * @retval State of bit (1 or 0). |
2487 | * @retval State of bit (1 or 0). |
| 2505 | */ |
2488 | */ |
| 2506 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx) |
2489 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx) |
| 2507 | { |
2490 | { |
| 2508 | return (READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)); |
2491 | return ((READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)) ? 1UL : 0UL); |
| 2509 | } |
2492 | } |
| 2510 | 2493 | ||
| 2511 | /** |
2494 | /** |
| 2512 | * @brief Set the clock source of the counter clock. |
2495 | * @brief Set the clock source of the counter clock. |
| 2513 | * @note when selected clock source is external clock mode 1, the timer input |
2496 | * @note when selected clock source is external clock mode 1, the timer input |
| 2514 | * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput() |
2497 | * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput() |
| 2515 | * function. This timer input must be configured by calling |
2498 | * function. This timer input must be configured by calling |
| 2516 | * the @ref LL_TIM_IC_Config() function. |
2499 | * the @ref LL_TIM_IC_Config() function. |
| 2517 | * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check |
2500 | * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check |
| 2518 | * whether or not a timer instance supports external clock mode1. |
2501 | * whether or not a timer instance supports external clock mode1. |
| 2519 | * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
2502 | * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check |
| 2520 | * whether or not a timer instance supports external clock mode2. |
2503 | * whether or not a timer instance supports external clock mode2. |
| 2521 | * @rmtoll SMCR SMS LL_TIM_SetClockSource\n |
2504 | * @rmtoll SMCR SMS LL_TIM_SetClockSource\n |
| 2522 | * SMCR ECE LL_TIM_SetClockSource |
2505 | * SMCR ECE LL_TIM_SetClockSource |
| 2523 | * @param TIMx Timer instance |
2506 | * @param TIMx Timer instance |
| 2524 | * @param ClockSource This parameter can be one of the following values: |
2507 | * @param ClockSource This parameter can be one of the following values: |
| Line 2532... | Line 2515... | ||
| 2532 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); |
2515 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); |
| 2533 | } |
2516 | } |
| 2534 | 2517 | ||
| 2535 | /** |
2518 | /** |
| 2536 | * @brief Set the encoder interface mode. |
2519 | * @brief Set the encoder interface mode. |
| 2537 | * @note Macro @ref IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check |
2520 | * @note Macro IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check |
| 2538 | * whether or not a timer instance supports the encoder mode. |
2521 | * whether or not a timer instance supports the encoder mode. |
| 2539 | * @rmtoll SMCR SMS LL_TIM_SetEncoderMode |
2522 | * @rmtoll SMCR SMS LL_TIM_SetEncoderMode |
| 2540 | * @param TIMx Timer instance |
2523 | * @param TIMx Timer instance |
| 2541 | * @param EncoderMode This parameter can be one of the following values: |
2524 | * @param EncoderMode This parameter can be one of the following values: |
| 2542 | * @arg @ref LL_TIM_ENCODERMODE_X2_TI1 |
2525 | * @arg @ref LL_TIM_ENCODERMODE_X2_TI1 |
| Line 2556... | Line 2539... | ||
| 2556 | /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration |
2539 | /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration |
| 2557 | * @{ |
2540 | * @{ |
| 2558 | */ |
2541 | */ |
| 2559 | /** |
2542 | /** |
| 2560 | * @brief Set the trigger output (TRGO) used for timer synchronization . |
2543 | * @brief Set the trigger output (TRGO) used for timer synchronization . |
| 2561 | * @note Macro @ref IS_TIM_MASTER_INSTANCE(TIMx) can be used to check |
2544 | * @note Macro IS_TIM_MASTER_INSTANCE(TIMx) can be used to check |
| 2562 | * whether or not a timer instance can operate as a master timer. |
2545 | * whether or not a timer instance can operate as a master timer. |
| 2563 | * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput |
2546 | * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput |
| 2564 | * @param TIMx Timer instance |
2547 | * @param TIMx Timer instance |
| 2565 | * @param TimerSynchronization This parameter can be one of the following values: |
2548 | * @param TimerSynchronization This parameter can be one of the following values: |
| 2566 | * @arg @ref LL_TIM_TRGO_RESET |
2549 | * @arg @ref LL_TIM_TRGO_RESET |
| Line 2578... | Line 2561... | ||
| 2578 | MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); |
2561 | MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); |
| 2579 | } |
2562 | } |
| 2580 | 2563 | ||
| 2581 | /** |
2564 | /** |
| 2582 | * @brief Set the synchronization mode of a slave timer. |
2565 | * @brief Set the synchronization mode of a slave timer. |
| 2583 | * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
2566 | * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
| 2584 | * a timer instance can operate as a slave timer. |
2567 | * a timer instance can operate as a slave timer. |
| 2585 | * @rmtoll SMCR SMS LL_TIM_SetSlaveMode |
2568 | * @rmtoll SMCR SMS LL_TIM_SetSlaveMode |
| 2586 | * @param TIMx Timer instance |
2569 | * @param TIMx Timer instance |
| 2587 | * @param SlaveMode This parameter can be one of the following values: |
2570 | * @param SlaveMode This parameter can be one of the following values: |
| 2588 | * @arg @ref LL_TIM_SLAVEMODE_DISABLED |
2571 | * @arg @ref LL_TIM_SLAVEMODE_DISABLED |
| Line 2596... | Line 2579... | ||
| 2596 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode); |
2579 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode); |
| 2597 | } |
2580 | } |
| 2598 | 2581 | ||
| 2599 | /** |
2582 | /** |
| 2600 | * @brief Set the selects the trigger input to be used to synchronize the counter. |
2583 | * @brief Set the selects the trigger input to be used to synchronize the counter. |
| 2601 | * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
2584 | * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
| 2602 | * a timer instance can operate as a slave timer. |
2585 | * a timer instance can operate as a slave timer. |
| 2603 | * @rmtoll SMCR TS LL_TIM_SetTriggerInput |
2586 | * @rmtoll SMCR TS LL_TIM_SetTriggerInput |
| 2604 | * @param TIMx Timer instance |
2587 | * @param TIMx Timer instance |
| 2605 | * @param TriggerInput This parameter can be one of the following values: |
2588 | * @param TriggerInput This parameter can be one of the following values: |
| 2606 | * @arg @ref LL_TIM_TS_ITR0 |
2589 | * @arg @ref LL_TIM_TS_ITR0 |
| Line 2618... | Line 2601... | ||
| 2618 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput); |
2601 | MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput); |
| 2619 | } |
2602 | } |
| 2620 | 2603 | ||
| 2621 | /** |
2604 | /** |
| 2622 | * @brief Enable the Master/Slave mode. |
2605 | * @brief Enable the Master/Slave mode. |
| 2623 | * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
2606 | * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
| 2624 | * a timer instance can operate as a slave timer. |
2607 | * a timer instance can operate as a slave timer. |
| 2625 | * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode |
2608 | * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode |
| 2626 | * @param TIMx Timer instance |
2609 | * @param TIMx Timer instance |
| 2627 | * @retval None |
2610 | * @retval None |
| 2628 | */ |
2611 | */ |
| Line 2631... | Line 2614... | ||
| 2631 | SET_BIT(TIMx->SMCR, TIM_SMCR_MSM); |
2614 | SET_BIT(TIMx->SMCR, TIM_SMCR_MSM); |
| 2632 | } |
2615 | } |
| 2633 | 2616 | ||
| 2634 | /** |
2617 | /** |
| 2635 | * @brief Disable the Master/Slave mode. |
2618 | * @brief Disable the Master/Slave mode. |
| 2636 | * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
2619 | * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
| 2637 | * a timer instance can operate as a slave timer. |
2620 | * a timer instance can operate as a slave timer. |
| 2638 | * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode |
2621 | * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode |
| 2639 | * @param TIMx Timer instance |
2622 | * @param TIMx Timer instance |
| 2640 | * @retval None |
2623 | * @retval None |
| 2641 | */ |
2624 | */ |
| Line 2644... | Line 2627... | ||
| 2644 | CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); |
2627 | CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); |
| 2645 | } |
2628 | } |
| 2646 | 2629 | ||
| 2647 | /** |
2630 | /** |
| 2648 | * @brief Indicates whether the Master/Slave mode is enabled. |
2631 | * @brief Indicates whether the Master/Slave mode is enabled. |
| 2649 | * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
2632 | * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not |
| 2650 | * a timer instance can operate as a slave timer. |
2633 | * a timer instance can operate as a slave timer. |
| 2651 | * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode |
2634 | * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode |
| 2652 | * @param TIMx Timer instance |
2635 | * @param TIMx Timer instance |
| 2653 | * @retval State of bit (1 or 0). |
2636 | * @retval State of bit (1 or 0). |
| 2654 | */ |
2637 | */ |
| 2655 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx) |
2638 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx) |
| 2656 | { |
2639 | { |
| 2657 | return (READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)); |
2640 | return ((READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)) ? 1UL : 0UL); |
| 2658 | } |
2641 | } |
| 2659 | 2642 | ||
| 2660 | /** |
2643 | /** |
| 2661 | * @brief Configure the external trigger (ETR) input. |
2644 | * @brief Configure the external trigger (ETR) input. |
| 2662 | * @note Macro @ref IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not |
2645 | * @note Macro IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not |
| 2663 | * a timer instance provides an external trigger input. |
2646 | * a timer instance provides an external trigger input. |
| 2664 | * @rmtoll SMCR ETP LL_TIM_ConfigETR\n |
2647 | * @rmtoll SMCR ETP LL_TIM_ConfigETR\n |
| 2665 | * SMCR ETPS LL_TIM_ConfigETR\n |
2648 | * SMCR ETPS LL_TIM_ConfigETR\n |
| 2666 | * SMCR ETF LL_TIM_ConfigETR |
2649 | * SMCR ETF LL_TIM_ConfigETR |
| 2667 | * @param TIMx Timer instance |
2650 | * @param TIMx Timer instance |
| Line 2705... | Line 2688... | ||
| 2705 | /** @defgroup TIM_LL_EF_Break_Function Break function configuration |
2688 | /** @defgroup TIM_LL_EF_Break_Function Break function configuration |
| 2706 | * @{ |
2689 | * @{ |
| 2707 | */ |
2690 | */ |
| 2708 | /** |
2691 | /** |
| 2709 | * @brief Enable the break function. |
2692 | * @brief Enable the break function. |
| 2710 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2693 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2711 | * a timer instance provides a break input. |
2694 | * a timer instance provides a break input. |
| 2712 | * @rmtoll BDTR BKE LL_TIM_EnableBRK |
2695 | * @rmtoll BDTR BKE LL_TIM_EnableBRK |
| 2713 | * @param TIMx Timer instance |
2696 | * @param TIMx Timer instance |
| 2714 | * @retval None |
2697 | * @retval None |
| 2715 | */ |
2698 | */ |
| 2716 | __STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx) |
2699 | __STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx) |
| 2717 | { |
2700 | { |
| - | 2701 | __IO uint32_t tmpreg; |
|
| 2718 | SET_BIT(TIMx->BDTR, TIM_BDTR_BKE); |
2702 | SET_BIT(TIMx->BDTR, TIM_BDTR_BKE); |
| - | 2703 | /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ |
|
| - | 2704 | tmpreg = READ_REG(TIMx->BDTR); |
|
| - | 2705 | (void)(tmpreg); |
|
| 2719 | } |
2706 | } |
| 2720 | 2707 | ||
| 2721 | /** |
2708 | /** |
| 2722 | * @brief Disable the break function. |
2709 | * @brief Disable the break function. |
| 2723 | * @rmtoll BDTR BKE LL_TIM_DisableBRK |
2710 | * @rmtoll BDTR BKE LL_TIM_DisableBRK |
| 2724 | * @param TIMx Timer instance |
2711 | * @param TIMx Timer instance |
| 2725 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2712 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2726 | * a timer instance provides a break input. |
2713 | * a timer instance provides a break input. |
| 2727 | * @retval None |
2714 | * @retval None |
| 2728 | */ |
2715 | */ |
| 2729 | __STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx) |
2716 | __STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx) |
| 2730 | { |
2717 | { |
| - | 2718 | __IO uint32_t tmpreg; |
|
| 2731 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE); |
2719 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE); |
| - | 2720 | /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ |
|
| - | 2721 | tmpreg = READ_REG(TIMx->BDTR); |
|
| - | 2722 | (void)(tmpreg); |
|
| 2732 | } |
2723 | } |
| 2733 | 2724 | ||
| 2734 | /** |
2725 | /** |
| 2735 | * @brief Configure the break input. |
2726 | * @brief Configure the break input. |
| 2736 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2727 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2737 | * a timer instance provides a break input. |
2728 | * a timer instance provides a break input. |
| 2738 | * @rmtoll BDTR BKP LL_TIM_ConfigBRK |
2729 | * @rmtoll BDTR BKP LL_TIM_ConfigBRK |
| 2739 | * @param TIMx Timer instance |
2730 | * @param TIMx Timer instance |
| 2740 | * @param BreakPolarity This parameter can be one of the following values: |
2731 | * @param BreakPolarity This parameter can be one of the following values: |
| 2741 | * @arg @ref LL_TIM_BREAK_POLARITY_LOW |
2732 | * @arg @ref LL_TIM_BREAK_POLARITY_LOW |
| 2742 | * @arg @ref LL_TIM_BREAK_POLARITY_HIGH |
2733 | * @arg @ref LL_TIM_BREAK_POLARITY_HIGH |
| 2743 | * @retval None |
2734 | * @retval None |
| 2744 | */ |
2735 | */ |
| 2745 | __STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity) |
2736 | __STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity) |
| 2746 | { |
2737 | { |
| - | 2738 | __IO uint32_t tmpreg; |
|
| 2747 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity); |
2739 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity); |
| - | 2740 | /* Note: Any write operation to BKP bit takes a delay of 1 APB clock cycle to become effective. */ |
|
| - | 2741 | tmpreg = READ_REG(TIMx->BDTR); |
|
| - | 2742 | (void)(tmpreg); |
|
| 2748 | } |
2743 | } |
| 2749 | 2744 | ||
| 2750 | /** |
2745 | /** |
| 2751 | * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes. |
2746 | * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes. |
| 2752 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2747 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2753 | * a timer instance provides a break input. |
2748 | * a timer instance provides a break input. |
| 2754 | * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n |
2749 | * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n |
| 2755 | * BDTR OSSR LL_TIM_SetOffStates |
2750 | * BDTR OSSR LL_TIM_SetOffStates |
| 2756 | * @param TIMx Timer instance |
2751 | * @param TIMx Timer instance |
| 2757 | * @param OffStateIdle This parameter can be one of the following values: |
2752 | * @param OffStateIdle This parameter can be one of the following values: |
| Line 2767... | Line 2762... | ||
| 2767 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun); |
2762 | MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun); |
| 2768 | } |
2763 | } |
| 2769 | 2764 | ||
| 2770 | /** |
2765 | /** |
| 2771 | * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active). |
2766 | * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active). |
| 2772 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2767 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2773 | * a timer instance provides a break input. |
2768 | * a timer instance provides a break input. |
| 2774 | * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput |
2769 | * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput |
| 2775 | * @param TIMx Timer instance |
2770 | * @param TIMx Timer instance |
| 2776 | * @retval None |
2771 | * @retval None |
| 2777 | */ |
2772 | */ |
| Line 2780... | Line 2775... | ||
| 2780 | SET_BIT(TIMx->BDTR, TIM_BDTR_AOE); |
2775 | SET_BIT(TIMx->BDTR, TIM_BDTR_AOE); |
| 2781 | } |
2776 | } |
| 2782 | 2777 | ||
| 2783 | /** |
2778 | /** |
| 2784 | * @brief Disable automatic output (MOE can be set only by software). |
2779 | * @brief Disable automatic output (MOE can be set only by software). |
| 2785 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2780 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2786 | * a timer instance provides a break input. |
2781 | * a timer instance provides a break input. |
| 2787 | * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput |
2782 | * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput |
| 2788 | * @param TIMx Timer instance |
2783 | * @param TIMx Timer instance |
| 2789 | * @retval None |
2784 | * @retval None |
| 2790 | */ |
2785 | */ |
| Line 2793... | Line 2788... | ||
| 2793 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE); |
2788 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE); |
| 2794 | } |
2789 | } |
| 2795 | 2790 | ||
| 2796 | /** |
2791 | /** |
| 2797 | * @brief Indicate whether automatic output is enabled. |
2792 | * @brief Indicate whether automatic output is enabled. |
| 2798 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2793 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2799 | * a timer instance provides a break input. |
2794 | * a timer instance provides a break input. |
| 2800 | * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput |
2795 | * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput |
| 2801 | * @param TIMx Timer instance |
2796 | * @param TIMx Timer instance |
| 2802 | * @retval State of bit (1 or 0). |
2797 | * @retval State of bit (1 or 0). |
| 2803 | */ |
2798 | */ |
| 2804 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx) |
2799 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx) |
| 2805 | { |
2800 | { |
| 2806 | return (READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)); |
2801 | return ((READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)) ? 1UL : 0UL); |
| 2807 | } |
2802 | } |
| 2808 | 2803 | ||
| 2809 | /** |
2804 | /** |
| 2810 | * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register). |
2805 | * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register). |
| 2811 | * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by |
2806 | * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by |
| 2812 | * software and is reset in case of break or break2 event |
2807 | * software and is reset in case of break or break2 event |
| 2813 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2808 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2814 | * a timer instance provides a break input. |
2809 | * a timer instance provides a break input. |
| 2815 | * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs |
2810 | * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs |
| 2816 | * @param TIMx Timer instance |
2811 | * @param TIMx Timer instance |
| 2817 | * @retval None |
2812 | * @retval None |
| 2818 | */ |
2813 | */ |
| Line 2823... | Line 2818... | ||
| 2823 | 2818 | ||
| 2824 | /** |
2819 | /** |
| 2825 | * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register). |
2820 | * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register). |
| 2826 | * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by |
2821 | * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by |
| 2827 | * software and is reset in case of break or break2 event. |
2822 | * software and is reset in case of break or break2 event. |
| 2828 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2823 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2829 | * a timer instance provides a break input. |
2824 | * a timer instance provides a break input. |
| 2830 | * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs |
2825 | * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs |
| 2831 | * @param TIMx Timer instance |
2826 | * @param TIMx Timer instance |
| 2832 | * @retval None |
2827 | * @retval None |
| 2833 | */ |
2828 | */ |
| Line 2836... | Line 2831... | ||
| 2836 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE); |
2831 | CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE); |
| 2837 | } |
2832 | } |
| 2838 | 2833 | ||
| 2839 | /** |
2834 | /** |
| 2840 | * @brief Indicates whether outputs are enabled. |
2835 | * @brief Indicates whether outputs are enabled. |
| 2841 | * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
2836 | * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not |
| 2842 | * a timer instance provides a break input. |
2837 | * a timer instance provides a break input. |
| 2843 | * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs |
2838 | * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs |
| 2844 | * @param TIMx Timer instance |
2839 | * @param TIMx Timer instance |
| 2845 | * @retval State of bit (1 or 0). |
2840 | * @retval State of bit (1 or 0). |
| 2846 | */ |
2841 | */ |
| 2847 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx) |
2842 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx) |
| 2848 | { |
2843 | { |
| 2849 | return (READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)); |
2844 | return ((READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)) ? 1UL : 0UL); |
| 2850 | } |
2845 | } |
| 2851 | 2846 | ||
| 2852 | /** |
2847 | /** |
| 2853 | * @} |
2848 | * @} |
| 2854 | */ |
2849 | */ |
| Line 2856... | Line 2851... | ||
| 2856 | /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration |
2851 | /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration |
| 2857 | * @{ |
2852 | * @{ |
| 2858 | */ |
2853 | */ |
| 2859 | /** |
2854 | /** |
| 2860 | * @brief Configures the timer DMA burst feature. |
2855 | * @brief Configures the timer DMA burst feature. |
| 2861 | * @note Macro @ref IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or |
2856 | * @note Macro IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or |
| 2862 | * not a timer instance supports the DMA burst mode. |
2857 | * not a timer instance supports the DMA burst mode. |
| 2863 | * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n |
2858 | * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n |
| 2864 | * DCR DBA LL_TIM_ConfigDMABurst |
2859 | * DCR DBA LL_TIM_ConfigDMABurst |
| 2865 | * @param TIMx Timer instance |
2860 | * @param TIMx Timer instance |
| 2866 | * @param DMABurstBaseAddress This parameter can be one of the following values: |
2861 | * @param DMABurstBaseAddress This parameter can be one of the following values: |
| Line 2903... | Line 2898... | ||
| 2903 | * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS |
2898 | * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS |
| 2904 | * @retval None |
2899 | * @retval None |
| 2905 | */ |
2900 | */ |
| 2906 | __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength) |
2901 | __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength) |
| 2907 | { |
2902 | { |
| 2908 | MODIFY_REG(TIMx->DCR, TIM_DCR_DBL | TIM_DCR_DBA, DMABurstBaseAddress | DMABurstLength); |
2903 | MODIFY_REG(TIMx->DCR, (TIM_DCR_DBL | TIM_DCR_DBA), (DMABurstBaseAddress | DMABurstLength)); |
| 2909 | } |
2904 | } |
| 2910 | 2905 | ||
| 2911 | /** |
2906 | /** |
| 2912 | * @} |
2907 | * @} |
| 2913 | */ |
2908 | */ |
| Line 2915... | Line 2910... | ||
| 2915 | 2910 | ||
| 2916 | /** |
2911 | /** |
| 2917 | * @} |
2912 | * @} |
| 2918 | */ |
2913 | */ |
| 2919 | 2914 | ||
| 2920 | - | ||
| 2921 | /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management |
2915 | /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management |
| 2922 | * @{ |
2916 | * @{ |
| 2923 | */ |
2917 | */ |
| 2924 | /** |
2918 | /** |
| 2925 | * @brief Clear the update interrupt flag (UIF). |
2919 | * @brief Clear the update interrupt flag (UIF). |
| Line 2938... | Line 2932... | ||
| 2938 | * @param TIMx Timer instance |
2932 | * @param TIMx Timer instance |
| 2939 | * @retval State of bit (1 or 0). |
2933 | * @retval State of bit (1 or 0). |
| 2940 | */ |
2934 | */ |
| 2941 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx) |
2935 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx) |
| 2942 | { |
2936 | { |
| 2943 | return (READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)); |
2937 | return ((READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL); |
| 2944 | } |
2938 | } |
| 2945 | 2939 | ||
| 2946 | /** |
2940 | /** |
| 2947 | * @brief Clear the Capture/Compare 1 interrupt flag (CC1F). |
2941 | * @brief Clear the Capture/Compare 1 interrupt flag (CC1F). |
| 2948 | * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1 |
2942 | * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1 |
| Line 2960... | Line 2954... | ||
| 2960 | * @param TIMx Timer instance |
2954 | * @param TIMx Timer instance |
| 2961 | * @retval State of bit (1 or 0). |
2955 | * @retval State of bit (1 or 0). |
| 2962 | */ |
2956 | */ |
| 2963 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx) |
2957 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx) |
| 2964 | { |
2958 | { |
| 2965 | return (READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)); |
2959 | return ((READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL); |
| 2966 | } |
2960 | } |
| 2967 | 2961 | ||
| 2968 | /** |
2962 | /** |
| 2969 | * @brief Clear the Capture/Compare 2 interrupt flag (CC2F). |
2963 | * @brief Clear the Capture/Compare 2 interrupt flag (CC2F). |
| 2970 | * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2 |
2964 | * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2 |
| Line 2982... | Line 2976... | ||
| 2982 | * @param TIMx Timer instance |
2976 | * @param TIMx Timer instance |
| 2983 | * @retval State of bit (1 or 0). |
2977 | * @retval State of bit (1 or 0). |
| 2984 | */ |
2978 | */ |
| 2985 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx) |
2979 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx) |
| 2986 | { |
2980 | { |
| 2987 | return (READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)); |
2981 | return ((READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL); |
| 2988 | } |
2982 | } |
| 2989 | 2983 | ||
| 2990 | /** |
2984 | /** |
| 2991 | * @brief Clear the Capture/Compare 3 interrupt flag (CC3F). |
2985 | * @brief Clear the Capture/Compare 3 interrupt flag (CC3F). |
| 2992 | * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3 |
2986 | * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3 |
| Line 3004... | Line 2998... | ||
| 3004 | * @param TIMx Timer instance |
2998 | * @param TIMx Timer instance |
| 3005 | * @retval State of bit (1 or 0). |
2999 | * @retval State of bit (1 or 0). |
| 3006 | */ |
3000 | */ |
| 3007 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx) |
3001 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx) |
| 3008 | { |
3002 | { |
| 3009 | return (READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)); |
3003 | return ((READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL); |
| 3010 | } |
3004 | } |
| 3011 | 3005 | ||
| 3012 | /** |
3006 | /** |
| 3013 | * @brief Clear the Capture/Compare 4 interrupt flag (CC4F). |
3007 | * @brief Clear the Capture/Compare 4 interrupt flag (CC4F). |
| 3014 | * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4 |
3008 | * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4 |
| Line 3026... | Line 3020... | ||
| 3026 | * @param TIMx Timer instance |
3020 | * @param TIMx Timer instance |
| 3027 | * @retval State of bit (1 or 0). |
3021 | * @retval State of bit (1 or 0). |
| 3028 | */ |
3022 | */ |
| 3029 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx) |
3023 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx) |
| 3030 | { |
3024 | { |
| 3031 | return (READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)); |
3025 | return ((READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL); |
| 3032 | } |
3026 | } |
| 3033 | 3027 | ||
| 3034 | /** |
3028 | /** |
| 3035 | * @brief Clear the commutation interrupt flag (COMIF). |
3029 | * @brief Clear the commutation interrupt flag (COMIF). |
| 3036 | * @rmtoll SR COMIF LL_TIM_ClearFlag_COM |
3030 | * @rmtoll SR COMIF LL_TIM_ClearFlag_COM |
| Line 3048... | Line 3042... | ||
| 3048 | * @param TIMx Timer instance |
3042 | * @param TIMx Timer instance |
| 3049 | * @retval State of bit (1 or 0). |
3043 | * @retval State of bit (1 or 0). |
| 3050 | */ |
3044 | */ |
| 3051 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx) |
3045 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx) |
| 3052 | { |
3046 | { |
| 3053 | return (READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)); |
3047 | return ((READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)) ? 1UL : 0UL); |
| 3054 | } |
3048 | } |
| 3055 | 3049 | ||
| 3056 | /** |
3050 | /** |
| 3057 | * @brief Clear the trigger interrupt flag (TIF). |
3051 | * @brief Clear the trigger interrupt flag (TIF). |
| 3058 | * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG |
3052 | * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG |
| Line 3070... | Line 3064... | ||
| 3070 | * @param TIMx Timer instance |
3064 | * @param TIMx Timer instance |
| 3071 | * @retval State of bit (1 or 0). |
3065 | * @retval State of bit (1 or 0). |
| 3072 | */ |
3066 | */ |
| 3073 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx) |
3067 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx) |
| 3074 | { |
3068 | { |
| 3075 | return (READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)); |
3069 | return ((READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)) ? 1UL : 0UL); |
| 3076 | } |
3070 | } |
| 3077 | 3071 | ||
| 3078 | /** |
3072 | /** |
| 3079 | * @brief Clear the break interrupt flag (BIF). |
3073 | * @brief Clear the break interrupt flag (BIF). |
| 3080 | * @rmtoll SR BIF LL_TIM_ClearFlag_BRK |
3074 | * @rmtoll SR BIF LL_TIM_ClearFlag_BRK |
| Line 3092... | Line 3086... | ||
| 3092 | * @param TIMx Timer instance |
3086 | * @param TIMx Timer instance |
| 3093 | * @retval State of bit (1 or 0). |
3087 | * @retval State of bit (1 or 0). |
| 3094 | */ |
3088 | */ |
| 3095 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx) |
3089 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx) |
| 3096 | { |
3090 | { |
| 3097 | return (READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)); |
3091 | return ((READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL); |
| 3098 | } |
3092 | } |
| 3099 | 3093 | ||
| 3100 | /** |
3094 | /** |
| 3101 | * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF). |
3095 | * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF). |
| 3102 | * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR |
3096 | * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR |
| Line 3114... | Line 3108... | ||
| 3114 | * @param TIMx Timer instance |
3108 | * @param TIMx Timer instance |
| 3115 | * @retval State of bit (1 or 0). |
3109 | * @retval State of bit (1 or 0). |
| 3116 | */ |
3110 | */ |
| 3117 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) |
3111 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) |
| 3118 | { |
3112 | { |
| 3119 | return (READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)); |
3113 | return ((READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)) ? 1UL : 0UL); |
| 3120 | } |
3114 | } |
| 3121 | 3115 | ||
| 3122 | /** |
3116 | /** |
| 3123 | * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF). |
3117 | * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF). |
| 3124 | * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR |
3118 | * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR |
| Line 3136... | Line 3130... | ||
| 3136 | * @param TIMx Timer instance |
3130 | * @param TIMx Timer instance |
| 3137 | * @retval State of bit (1 or 0). |
3131 | * @retval State of bit (1 or 0). |
| 3138 | */ |
3132 | */ |
| 3139 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) |
3133 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) |
| 3140 | { |
3134 | { |
| 3141 | return (READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)); |
3135 | return ((READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)) ? 1UL : 0UL); |
| 3142 | } |
3136 | } |
| 3143 | 3137 | ||
| 3144 | /** |
3138 | /** |
| 3145 | * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF). |
3139 | * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF). |
| 3146 | * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR |
3140 | * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR |
| Line 3158... | Line 3152... | ||
| 3158 | * @param TIMx Timer instance |
3152 | * @param TIMx Timer instance |
| 3159 | * @retval State of bit (1 or 0). |
3153 | * @retval State of bit (1 or 0). |
| 3160 | */ |
3154 | */ |
| 3161 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) |
3155 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) |
| 3162 | { |
3156 | { |
| 3163 | return (READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)); |
3157 | return ((READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)) ? 1UL : 0UL); |
| 3164 | } |
3158 | } |
| 3165 | 3159 | ||
| 3166 | /** |
3160 | /** |
| 3167 | * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF). |
3161 | * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF). |
| 3168 | * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR |
3162 | * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR |
| Line 3180... | Line 3174... | ||
| 3180 | * @param TIMx Timer instance |
3174 | * @param TIMx Timer instance |
| 3181 | * @retval State of bit (1 or 0). |
3175 | * @retval State of bit (1 or 0). |
| 3182 | */ |
3176 | */ |
| 3183 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) |
3177 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) |
| 3184 | { |
3178 | { |
| 3185 | return (READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)); |
3179 | return ((READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)) ? 1UL : 0UL); |
| 3186 | } |
3180 | } |
| 3187 | 3181 | ||
| 3188 | /** |
3182 | /** |
| 3189 | * @} |
3183 | * @} |
| 3190 | */ |
3184 | */ |
| Line 3220... | Line 3214... | ||
| 3220 | * @param TIMx Timer instance |
3214 | * @param TIMx Timer instance |
| 3221 | * @retval State of bit (1 or 0). |
3215 | * @retval State of bit (1 or 0). |
| 3222 | */ |
3216 | */ |
| 3223 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx) |
3217 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx) |
| 3224 | { |
3218 | { |
| 3225 | return (READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)); |
3219 | return ((READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)) ? 1UL : 0UL); |
| 3226 | } |
3220 | } |
| 3227 | 3221 | ||
| 3228 | /** |
3222 | /** |
| 3229 | * @brief Enable capture/compare 1 interrupt (CC1IE). |
3223 | * @brief Enable capture/compare 1 interrupt (CC1IE). |
| 3230 | * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1 |
3224 | * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1 |
| Line 3253... | Line 3247... | ||
| 3253 | * @param TIMx Timer instance |
3247 | * @param TIMx Timer instance |
| 3254 | * @retval State of bit (1 or 0). |
3248 | * @retval State of bit (1 or 0). |
| 3255 | */ |
3249 | */ |
| 3256 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx) |
3250 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx) |
| 3257 | { |
3251 | { |
| 3258 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)); |
3252 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)) ? 1UL : 0UL); |
| 3259 | } |
3253 | } |
| 3260 | 3254 | ||
| 3261 | /** |
3255 | /** |
| 3262 | * @brief Enable capture/compare 2 interrupt (CC2IE). |
3256 | * @brief Enable capture/compare 2 interrupt (CC2IE). |
| 3263 | * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2 |
3257 | * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2 |
| Line 3286... | Line 3280... | ||
| 3286 | * @param TIMx Timer instance |
3280 | * @param TIMx Timer instance |
| 3287 | * @retval State of bit (1 or 0). |
3281 | * @retval State of bit (1 or 0). |
| 3288 | */ |
3282 | */ |
| 3289 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx) |
3283 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx) |
| 3290 | { |
3284 | { |
| 3291 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)); |
3285 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)) ? 1UL : 0UL); |
| 3292 | } |
3286 | } |
| 3293 | 3287 | ||
| 3294 | /** |
3288 | /** |
| 3295 | * @brief Enable capture/compare 3 interrupt (CC3IE). |
3289 | * @brief Enable capture/compare 3 interrupt (CC3IE). |
| 3296 | * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3 |
3290 | * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3 |
| Line 3319... | Line 3313... | ||
| 3319 | * @param TIMx Timer instance |
3313 | * @param TIMx Timer instance |
| 3320 | * @retval State of bit (1 or 0). |
3314 | * @retval State of bit (1 or 0). |
| 3321 | */ |
3315 | */ |
| 3322 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx) |
3316 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx) |
| 3323 | { |
3317 | { |
| 3324 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)); |
3318 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)) ? 1UL : 0UL); |
| 3325 | } |
3319 | } |
| 3326 | 3320 | ||
| 3327 | /** |
3321 | /** |
| 3328 | * @brief Enable capture/compare 4 interrupt (CC4IE). |
3322 | * @brief Enable capture/compare 4 interrupt (CC4IE). |
| 3329 | * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4 |
3323 | * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4 |
| Line 3352... | Line 3346... | ||
| 3352 | * @param TIMx Timer instance |
3346 | * @param TIMx Timer instance |
| 3353 | * @retval State of bit (1 or 0). |
3347 | * @retval State of bit (1 or 0). |
| 3354 | */ |
3348 | */ |
| 3355 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx) |
3349 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx) |
| 3356 | { |
3350 | { |
| 3357 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)); |
3351 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)) ? 1UL : 0UL); |
| 3358 | } |
3352 | } |
| 3359 | 3353 | ||
| 3360 | /** |
3354 | /** |
| 3361 | * @brief Enable commutation interrupt (COMIE). |
3355 | * @brief Enable commutation interrupt (COMIE). |
| 3362 | * @rmtoll DIER COMIE LL_TIM_EnableIT_COM |
3356 | * @rmtoll DIER COMIE LL_TIM_EnableIT_COM |
| Line 3385... | Line 3379... | ||
| 3385 | * @param TIMx Timer instance |
3379 | * @param TIMx Timer instance |
| 3386 | * @retval State of bit (1 or 0). |
3380 | * @retval State of bit (1 or 0). |
| 3387 | */ |
3381 | */ |
| 3388 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx) |
3382 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx) |
| 3389 | { |
3383 | { |
| 3390 | return (READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)); |
3384 | return ((READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)) ? 1UL : 0UL); |
| 3391 | } |
3385 | } |
| 3392 | 3386 | ||
| 3393 | /** |
3387 | /** |
| 3394 | * @brief Enable trigger interrupt (TIE). |
3388 | * @brief Enable trigger interrupt (TIE). |
| 3395 | * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG |
3389 | * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG |
| Line 3418... | Line 3412... | ||
| 3418 | * @param TIMx Timer instance |
3412 | * @param TIMx Timer instance |
| 3419 | * @retval State of bit (1 or 0). |
3413 | * @retval State of bit (1 or 0). |
| 3420 | */ |
3414 | */ |
| 3421 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx) |
3415 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx) |
| 3422 | { |
3416 | { |
| 3423 | return (READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)); |
3417 | return ((READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)) ? 1UL : 0UL); |
| 3424 | } |
3418 | } |
| 3425 | 3419 | ||
| 3426 | /** |
3420 | /** |
| 3427 | * @brief Enable break interrupt (BIE). |
3421 | * @brief Enable break interrupt (BIE). |
| 3428 | * @rmtoll DIER BIE LL_TIM_EnableIT_BRK |
3422 | * @rmtoll DIER BIE LL_TIM_EnableIT_BRK |
| Line 3451... | Line 3445... | ||
| 3451 | * @param TIMx Timer instance |
3445 | * @param TIMx Timer instance |
| 3452 | * @retval State of bit (1 or 0). |
3446 | * @retval State of bit (1 or 0). |
| 3453 | */ |
3447 | */ |
| 3454 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx) |
3448 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx) |
| 3455 | { |
3449 | { |
| 3456 | return (READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)); |
3450 | return ((READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)) ? 1UL : 0UL); |
| 3457 | } |
3451 | } |
| 3458 | 3452 | ||
| 3459 | /** |
3453 | /** |
| 3460 | * @} |
3454 | * @} |
| 3461 | */ |
3455 | */ |
| Line 3491... | Line 3485... | ||
| 3491 | * @param TIMx Timer instance |
3485 | * @param TIMx Timer instance |
| 3492 | * @retval State of bit (1 or 0). |
3486 | * @retval State of bit (1 or 0). |
| 3493 | */ |
3487 | */ |
| 3494 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx) |
3488 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx) |
| 3495 | { |
3489 | { |
| 3496 | return (READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)); |
3490 | return ((READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)) ? 1UL : 0UL); |
| 3497 | } |
3491 | } |
| 3498 | 3492 | ||
| 3499 | /** |
3493 | /** |
| 3500 | * @brief Enable capture/compare 1 DMA request (CC1DE). |
3494 | * @brief Enable capture/compare 1 DMA request (CC1DE). |
| 3501 | * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1 |
3495 | * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1 |
| Line 3524... | Line 3518... | ||
| 3524 | * @param TIMx Timer instance |
3518 | * @param TIMx Timer instance |
| 3525 | * @retval State of bit (1 or 0). |
3519 | * @retval State of bit (1 or 0). |
| 3526 | */ |
3520 | */ |
| 3527 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx) |
3521 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx) |
| 3528 | { |
3522 | { |
| 3529 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)); |
3523 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)) ? 1UL : 0UL); |
| 3530 | } |
3524 | } |
| 3531 | 3525 | ||
| 3532 | /** |
3526 | /** |
| 3533 | * @brief Enable capture/compare 2 DMA request (CC2DE). |
3527 | * @brief Enable capture/compare 2 DMA request (CC2DE). |
| 3534 | * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2 |
3528 | * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2 |
| Line 3557... | Line 3551... | ||
| 3557 | * @param TIMx Timer instance |
3551 | * @param TIMx Timer instance |
| 3558 | * @retval State of bit (1 or 0). |
3552 | * @retval State of bit (1 or 0). |
| 3559 | */ |
3553 | */ |
| 3560 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx) |
3554 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx) |
| 3561 | { |
3555 | { |
| 3562 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)); |
3556 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)) ? 1UL : 0UL); |
| 3563 | } |
3557 | } |
| 3564 | 3558 | ||
| 3565 | /** |
3559 | /** |
| 3566 | * @brief Enable capture/compare 3 DMA request (CC3DE). |
3560 | * @brief Enable capture/compare 3 DMA request (CC3DE). |
| 3567 | * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3 |
3561 | * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3 |
| Line 3590... | Line 3584... | ||
| 3590 | * @param TIMx Timer instance |
3584 | * @param TIMx Timer instance |
| 3591 | * @retval State of bit (1 or 0). |
3585 | * @retval State of bit (1 or 0). |
| 3592 | */ |
3586 | */ |
| 3593 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx) |
3587 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx) |
| 3594 | { |
3588 | { |
| 3595 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)); |
3589 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)) ? 1UL : 0UL); |
| 3596 | } |
3590 | } |
| 3597 | 3591 | ||
| 3598 | /** |
3592 | /** |
| 3599 | * @brief Enable capture/compare 4 DMA request (CC4DE). |
3593 | * @brief Enable capture/compare 4 DMA request (CC4DE). |
| 3600 | * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4 |
3594 | * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4 |
| Line 3623... | Line 3617... | ||
| 3623 | * @param TIMx Timer instance |
3617 | * @param TIMx Timer instance |
| 3624 | * @retval State of bit (1 or 0). |
3618 | * @retval State of bit (1 or 0). |
| 3625 | */ |
3619 | */ |
| 3626 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx) |
3620 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx) |
| 3627 | { |
3621 | { |
| 3628 | return (READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)); |
3622 | return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)) ? 1UL : 0UL); |
| 3629 | } |
3623 | } |
| 3630 | 3624 | ||
| 3631 | /** |
3625 | /** |
| 3632 | * @brief Enable commutation DMA request (COMDE). |
3626 | * @brief Enable commutation DMA request (COMDE). |
| 3633 | * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM |
3627 | * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM |
| Line 3656... | Line 3650... | ||
| 3656 | * @param TIMx Timer instance |
3650 | * @param TIMx Timer instance |
| 3657 | * @retval State of bit (1 or 0). |
3651 | * @retval State of bit (1 or 0). |
| 3658 | */ |
3652 | */ |
| 3659 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx) |
3653 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx) |
| 3660 | { |
3654 | { |
| 3661 | return (READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)); |
3655 | return ((READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)) ? 1UL : 0UL); |
| 3662 | } |
3656 | } |
| 3663 | 3657 | ||
| 3664 | /** |
3658 | /** |
| 3665 | * @brief Enable trigger interrupt (TDE). |
3659 | * @brief Enable trigger interrupt (TDE). |
| 3666 | * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG |
3660 | * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG |
| Line 3689... | Line 3683... | ||
| 3689 | * @param TIMx Timer instance |
3683 | * @param TIMx Timer instance |
| 3690 | * @retval State of bit (1 or 0). |
3684 | * @retval State of bit (1 or 0). |
| 3691 | */ |
3685 | */ |
| 3692 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx) |
3686 | __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx) |
| 3693 | { |
3687 | { |
| 3694 | return (READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)); |
3688 | return ((READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)) ? 1UL : 0UL); |
| 3695 | } |
3689 | } |
| 3696 | 3690 | ||
| 3697 | /** |
3691 | /** |
| 3698 | * @} |
3692 | * @} |
| 3699 | */ |
3693 | */ |