Rev 56 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 56 | Rev 61 | ||
---|---|---|---|
Line 144... | Line 144... | ||
144 | typedef struct |
144 | typedef struct |
145 | { |
145 | { |
146 | uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. |
146 | uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. |
147 | This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
147 | This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
148 | 148 | ||
149 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetPrescaler().*/ |
149 | This feature can be modified afterwards using unitary function |
- | 150 | @ref LL_TIM_SetPrescaler().*/ |
|
150 | 151 | ||
151 | uint32_t CounterMode; /*!< Specifies the counter mode. |
152 | uint32_t CounterMode; /*!< Specifies the counter mode. |
152 | This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE. |
153 | This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE. |
153 | 154 | ||
154 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetCounterMode().*/ |
155 | This feature can be modified afterwards using unitary function |
- | 156 | @ref LL_TIM_SetCounterMode().*/ |
|
155 | 157 | ||
156 | uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active |
158 | uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active |
157 | Auto-Reload Register at the next update event. |
159 | Auto-Reload Register at the next update event. |
158 | This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
160 | This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
159 | Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF. |
161 | Some timer instances may support 32 bits counters. In that case this parameter must |
- | 162 | be a number between 0x0000 and 0xFFFFFFFF. |
|
160 | 163 | ||
161 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetAutoReload().*/ |
164 | This feature can be modified afterwards using unitary function |
- | 165 | @ref LL_TIM_SetAutoReload().*/ |
|
162 | 166 | ||
163 | uint32_t ClockDivision; /*!< Specifies the clock division. |
167 | uint32_t ClockDivision; /*!< Specifies the clock division. |
164 | This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. |
168 | This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. |
165 | 169 | ||
166 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/ |
170 | This feature can be modified afterwards using unitary function |
- | 171 | @ref LL_TIM_SetClockDivision().*/ |
|
167 | } LL_TIM_InitTypeDef; |
172 | } LL_TIM_InitTypeDef; |
168 | 173 | ||
169 | /** |
174 | /** |
170 | * @brief TIM Output Compare configuration structure definition. |
175 | * @brief TIM Output Compare configuration structure definition. |
171 | */ |
176 | */ |
172 | typedef struct |
177 | typedef struct |
173 | { |
178 | { |
174 | uint32_t OCMode; /*!< Specifies the output mode. |
179 | uint32_t OCMode; /*!< Specifies the output mode. |
175 | This parameter can be a value of @ref TIM_LL_EC_OCMODE. |
180 | This parameter can be a value of @ref TIM_LL_EC_OCMODE. |
176 | 181 | ||
177 | This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetMode().*/ |
182 | This feature can be modified afterwards using unitary function |
- | 183 | @ref LL_TIM_OC_SetMode().*/ |
|
178 | 184 | ||
179 | uint32_t OCState; /*!< Specifies the TIM Output Compare state. |
185 | uint32_t OCState; /*!< Specifies the TIM Output Compare state. |
180 | This parameter can be a value of @ref TIM_LL_EC_OCSTATE. |
186 | This parameter can be a value of @ref TIM_LL_EC_OCSTATE. |
181 | 187 | ||
- | 188 | This feature can be modified afterwards using unitary functions |
|
182 | This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ |
189 | @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ |
183 | 190 | ||
184 | uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register. |
191 | uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register. |
185 | This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
192 | This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. |
186 | 193 | ||
187 | This feature can be modified afterwards using unitary function LL_TIM_OC_SetCompareCHx (x=1..6).*/ |
194 | This feature can be modified afterwards using unitary function |
- | 195 | LL_TIM_OC_SetCompareCHx (x=1..6).*/ |
|
188 | 196 | ||
189 | uint32_t OCPolarity; /*!< Specifies the output polarity. |
197 | uint32_t OCPolarity; /*!< Specifies the output polarity. |
190 | This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. |
198 | This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. |
191 | 199 | ||
192 | This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/ |
200 | This feature can be modified afterwards using unitary function |
- | 201 | @ref LL_TIM_OC_SetPolarity().*/ |
|
193 | 202 | ||
194 | 203 | ||
195 | } LL_TIM_OC_InitTypeDef; |
204 | } LL_TIM_OC_InitTypeDef; |
196 | 205 | ||
197 | /** |
206 | /** |
Line 202... | Line 211... | ||
202 | { |
211 | { |
203 | 212 | ||
204 | uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. |
213 | uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. |
205 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
214 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
206 | 215 | ||
207 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ |
216 | This feature can be modified afterwards using unitary function |
- | 217 | @ref LL_TIM_IC_SetPolarity().*/ |
|
208 | 218 | ||
209 | uint32_t ICActiveInput; /*!< Specifies the input. |
219 | uint32_t ICActiveInput; /*!< Specifies the input. |
210 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
220 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
211 | 221 | ||
212 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ |
222 | This feature can be modified afterwards using unitary function |
- | 223 | @ref LL_TIM_IC_SetActiveInput().*/ |
|
213 | 224 | ||
214 | uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. |
225 | uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. |
215 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
226 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
216 | 227 | ||
217 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ |
228 | This feature can be modified afterwards using unitary function |
- | 229 | @ref LL_TIM_IC_SetPrescaler().*/ |
|
218 | 230 | ||
219 | uint32_t ICFilter; /*!< Specifies the input capture filter. |
231 | uint32_t ICFilter; /*!< Specifies the input capture filter. |
220 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
232 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
221 | 233 | ||
222 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ |
234 | This feature can be modified afterwards using unitary function |
- | 235 | @ref LL_TIM_IC_SetFilter().*/ |
|
223 | } LL_TIM_IC_InitTypeDef; |
236 | } LL_TIM_IC_InitTypeDef; |
224 | 237 | ||
225 | 238 | ||
226 | /** |
239 | /** |
227 | * @brief TIM Encoder interface configuration structure definition. |
240 | * @brief TIM Encoder interface configuration structure definition. |
Line 229... | Line 242... | ||
229 | typedef struct |
242 | typedef struct |
230 | { |
243 | { |
231 | uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4). |
244 | uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4). |
232 | This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE. |
245 | This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE. |
233 | 246 | ||
234 | This feature can be modified afterwards using unitary function @ref LL_TIM_SetEncoderMode().*/ |
247 | This feature can be modified afterwards using unitary function |
- | 248 | @ref LL_TIM_SetEncoderMode().*/ |
|
235 | 249 | ||
236 | uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. |
250 | uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. |
237 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
251 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
238 | 252 | ||
239 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ |
253 | This feature can be modified afterwards using unitary function |
- | 254 | @ref LL_TIM_IC_SetPolarity().*/ |
|
240 | 255 | ||
241 | uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source |
256 | uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source |
242 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
257 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
243 | 258 | ||
244 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ |
259 | This feature can be modified afterwards using unitary function |
- | 260 | @ref LL_TIM_IC_SetActiveInput().*/ |
|
245 | 261 | ||
246 | uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. |
262 | uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. |
247 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
263 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
248 | 264 | ||
249 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ |
265 | This feature can be modified afterwards using unitary function |
- | 266 | @ref LL_TIM_IC_SetPrescaler().*/ |
|
250 | 267 | ||
251 | uint32_t IC1Filter; /*!< Specifies the TI1 input filter. |
268 | uint32_t IC1Filter; /*!< Specifies the TI1 input filter. |
252 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
269 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
253 | 270 | ||
254 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ |
271 | This feature can be modified afterwards using unitary function |
- | 272 | @ref LL_TIM_IC_SetFilter().*/ |
|
255 | 273 | ||
256 | uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input. |
274 | uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input. |
257 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
275 | This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. |
258 | 276 | ||
259 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/ |
277 | This feature can be modified afterwards using unitary function |
- | 278 | @ref LL_TIM_IC_SetPolarity().*/ |
|
260 | 279 | ||
261 | uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source |
280 | uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source |
262 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
281 | This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. |
263 | 282 | ||
264 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/ |
283 | This feature can be modified afterwards using unitary function |
- | 284 | @ref LL_TIM_IC_SetActiveInput().*/ |
|
265 | 285 | ||
266 | uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value. |
286 | uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value. |
267 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
287 | This parameter can be a value of @ref TIM_LL_EC_ICPSC. |
268 | 288 | ||
269 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/ |
289 | This feature can be modified afterwards using unitary function |
- | 290 | @ref LL_TIM_IC_SetPrescaler().*/ |
|
270 | 291 | ||
271 | uint32_t IC2Filter; /*!< Specifies the TI2 input filter. |
292 | uint32_t IC2Filter; /*!< Specifies the TI2 input filter. |
272 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
293 | This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. |
273 | 294 | ||
274 | This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/ |
295 | This feature can be modified afterwards using unitary function |
- | 296 | @ref LL_TIM_IC_SetFilter().*/ |
|
275 | 297 | ||
276 | } LL_TIM_ENCODER_InitTypeDef; |
298 | } LL_TIM_ENCODER_InitTypeDef; |
277 | 299 | ||
278 | 300 | ||
279 | /** |
301 | /** |
Line 328... | Line 350... | ||
328 | */ |
350 | */ |
329 | 351 | ||
330 | /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode |
352 | /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode |
331 | * @{ |
353 | * @{ |
332 | */ |
354 | */ |
333 | #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter is not stopped at update event */ |
355 | #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */ |
334 | #define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter stops counting at the next update event */ |
356 | #define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */ |
335 | /** |
357 | /** |
336 | * @} |
358 | * @} |
337 | */ |
359 | */ |
338 | 360 | ||
339 | /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode |
361 | /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode |
Line 802... | Line 824... | ||
802 | */ |
824 | */ |
803 | #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ |
825 | #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ |
804 | ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) |
826 | ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) |
805 | 827 | ||
806 | /** |
828 | /** |
807 | * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay. |
829 | * @brief HELPER macro calculating the compare value required to achieve the required timer output compare |
- | 830 | * active/inactive delay. |
|
808 | * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); |
831 | * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); |
809 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
832 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
810 | * @param __PSC__ prescaler |
833 | * @param __PSC__ prescaler |
811 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
834 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
812 | * @retval Compare value (between Min_Data=0 and Max_Data=65535) |
835 | * @retval Compare value (between Min_Data=0 and Max_Data=65535) |
Line 814... | Line 837... | ||
814 | #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ |
837 | #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ |
815 | ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ |
838 | ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ |
816 | / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) |
839 | / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) |
817 | 840 | ||
818 | /** |
841 | /** |
819 | * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode). |
842 | * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration |
- | 843 | * (when the timer operates in one pulse mode). |
|
820 | * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); |
844 | * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); |
821 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
845 | * @param __TIMCLK__ timer input clock frequency (in Hz) |
822 | * @param __PSC__ prescaler |
846 | * @param __PSC__ prescaler |
823 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
847 | * @param __DELAY__ timer output compare active/inactive delay (in us) |
824 | * @param __PULSE__ pulse duration (in us) |
848 | * @param __PULSE__ pulse duration (in us) |
Line 1025... | Line 1049... | ||
1025 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN |
1049 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN |
1026 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN |
1050 | * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN |
1027 | */ |
1051 | */ |
1028 | __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx) |
1052 | __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx) |
1029 | { |
1053 | { |
- | 1054 | uint32_t counter_mode; |
|
- | 1055 | ||
1030 | return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS)); |
1056 | counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CMS)); |
- | 1057 | ||
- | 1058 | if (counter_mode == 0U) |
|
- | 1059 | { |
|
- | 1060 | counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); |
|
- | 1061 | } |
|
- | 1062 | ||
- | 1063 | return counter_mode; |
|
1031 | } |
1064 | } |
1032 | 1065 | ||
1033 | /** |
1066 | /** |
1034 | * @brief Enable auto-reload (ARR) preload. |
1067 | * @brief Enable auto-reload (ARR) preload. |
1035 | * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload |
1068 | * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload |
Line 1062... | Line 1095... | ||
1062 | { |
1095 | { |
1063 | return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); |
1096 | return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); |
1064 | } |
1097 | } |
1065 | 1098 | ||
1066 | /** |
1099 | /** |
1067 | * @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. |
1100 | * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators |
- | 1101 | * (when supported) and the digital filters. |
|
1068 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1102 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1069 | * whether or not the clock division feature is supported by the timer |
1103 | * whether or not the clock division feature is supported by the timer |
1070 | * instance. |
1104 | * instance. |
1071 | * @rmtoll CR1 CKD LL_TIM_SetClockDivision |
1105 | * @rmtoll CR1 CKD LL_TIM_SetClockDivision |
1072 | * @param TIMx Timer instance |
1106 | * @param TIMx Timer instance |
Line 1080... | Line 1114... | ||
1080 | { |
1114 | { |
1081 | MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); |
1115 | MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); |
1082 | } |
1116 | } |
1083 | 1117 | ||
1084 | /** |
1118 | /** |
1085 | * @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. |
1119 | * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time |
- | 1120 | * generators (when supported) and the digital filters. |
|
1086 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1121 | * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check |
1087 | * whether or not the clock division feature is supported by the timer |
1122 | * whether or not the clock division feature is supported by the timer |
1088 | * instance. |
1123 | * instance. |
1089 | * @rmtoll CR1 CKD LL_TIM_GetClockDivision |
1124 | * @rmtoll CR1 CKD LL_TIM_GetClockDivision |
1090 | * @param TIMx Timer instance |
1125 | * @param TIMx Timer instance |
Line 1312... | Line 1347... | ||
1312 | * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW |
1347 | * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW |
1313 | * @retval None |
1348 | * @retval None |
1314 | */ |
1349 | */ |
1315 | __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
1350 | __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
1316 | { |
1351 | { |
1317 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1352 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1318 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1353 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1319 | CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); |
1354 | CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); |
1320 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), |
1355 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), |
1321 | (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); |
1356 | (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); |
1322 | } |
1357 | } |
1323 | 1358 | ||
Line 1345... | Line 1380... | ||
1345 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1380 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1346 | * @retval None |
1381 | * @retval None |
1347 | */ |
1382 | */ |
1348 | __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) |
1383 | __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) |
1349 | { |
1384 | { |
1350 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1385 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1351 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1386 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1352 | MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); |
1387 | MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); |
1353 | } |
1388 | } |
1354 | 1389 | ||
1355 | /** |
1390 | /** |
1356 | * @brief Get the output compare mode of an output channel. |
1391 | * @brief Get the output compare mode of an output channel. |
1357 | * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n |
1392 | * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n |
Line 1374... | Line 1409... | ||
1374 | * @arg @ref LL_TIM_OCMODE_PWM1 |
1409 | * @arg @ref LL_TIM_OCMODE_PWM1 |
1375 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1410 | * @arg @ref LL_TIM_OCMODE_PWM2 |
1376 | */ |
1411 | */ |
1377 | __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) |
1412 | __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) |
1378 | { |
1413 | { |
1379 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1414 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1380 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1415 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1381 | return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); |
1416 | return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); |
1382 | } |
1417 | } |
1383 | 1418 | ||
1384 | /** |
1419 | /** |
1385 | * @brief Set the polarity of an output channel. |
1420 | * @brief Set the polarity of an output channel. |
1386 | * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n |
1421 | * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n |
Line 1398... | Line 1433... | ||
1398 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1433 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1399 | * @retval None |
1434 | * @retval None |
1400 | */ |
1435 | */ |
1401 | __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) |
1436 | __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) |
1402 | { |
1437 | { |
1403 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1438 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1404 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); |
1439 | MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); |
1405 | } |
1440 | } |
1406 | 1441 | ||
1407 | /** |
1442 | /** |
1408 | * @brief Get the polarity of an output channel. |
1443 | * @brief Get the polarity of an output channel. |
Line 1420... | Line 1455... | ||
1420 | * @arg @ref LL_TIM_OCPOLARITY_HIGH |
1455 | * @arg @ref LL_TIM_OCPOLARITY_HIGH |
1421 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1456 | * @arg @ref LL_TIM_OCPOLARITY_LOW |
1422 | */ |
1457 | */ |
1423 | __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
1458 | __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
1424 | { |
1459 | { |
1425 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1460 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1426 | return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); |
1461 | return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); |
1427 | } |
1462 | } |
1428 | 1463 | ||
1429 | /** |
1464 | /** |
1430 | * @brief Enable fast mode for the output channel. |
1465 | * @brief Enable fast mode for the output channel. |
Line 1441... | Line 1476... | ||
1441 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1476 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1442 | * @retval None |
1477 | * @retval None |
1443 | */ |
1478 | */ |
1444 | __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1479 | __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1445 | { |
1480 | { |
1446 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1481 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1447 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1482 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1448 | SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1483 | SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1449 | 1484 | ||
1450 | } |
1485 | } |
1451 | 1486 | ||
1452 | /** |
1487 | /** |
Line 1463... | Line 1498... | ||
1463 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1498 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1464 | * @retval None |
1499 | * @retval None |
1465 | */ |
1500 | */ |
1466 | __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1501 | __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1467 | { |
1502 | { |
1468 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1503 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1469 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1504 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1470 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1505 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); |
1471 | 1506 | ||
1472 | } |
1507 | } |
1473 | 1508 | ||
1474 | /** |
1509 | /** |
Line 1485... | Line 1520... | ||
1485 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1520 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1486 | * @retval State of bit (1 or 0). |
1521 | * @retval State of bit (1 or 0). |
1487 | */ |
1522 | */ |
1488 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1523 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) |
1489 | { |
1524 | { |
1490 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1525 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1491 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1526 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1492 | uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; |
1527 | uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; |
1493 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1528 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1494 | } |
1529 | } |
1495 | 1530 | ||
1496 | /** |
1531 | /** |
1497 | * @brief Enable compare register (TIMx_CCRx) preload for the output channel. |
1532 | * @brief Enable compare register (TIMx_CCRx) preload for the output channel. |
Line 1507... | Line 1542... | ||
1507 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1542 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1508 | * @retval None |
1543 | * @retval None |
1509 | */ |
1544 | */ |
1510 | __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1545 | __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1511 | { |
1546 | { |
1512 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1547 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1513 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1548 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1514 | SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1549 | SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1515 | } |
1550 | } |
1516 | 1551 | ||
1517 | /** |
1552 | /** |
1518 | * @brief Disable compare register (TIMx_CCRx) preload for the output channel. |
1553 | * @brief Disable compare register (TIMx_CCRx) preload for the output channel. |
Line 1528... | Line 1563... | ||
1528 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1563 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1529 | * @retval None |
1564 | * @retval None |
1530 | */ |
1565 | */ |
1531 | __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1566 | __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1532 | { |
1567 | { |
1533 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1568 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1534 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1569 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1535 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1570 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); |
1536 | } |
1571 | } |
1537 | 1572 | ||
1538 | /** |
1573 | /** |
1539 | * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. |
1574 | * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. |
Line 1549... | Line 1584... | ||
1549 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1584 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1550 | * @retval State of bit (1 or 0). |
1585 | * @retval State of bit (1 or 0). |
1551 | */ |
1586 | */ |
1552 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1587 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) |
1553 | { |
1588 | { |
1554 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1589 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1555 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1590 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1556 | uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; |
1591 | uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; |
1557 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1592 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1558 | } |
1593 | } |
1559 | 1594 | ||
1560 | /** |
1595 | /** |
1561 | * @brief Enable clearing the output channel on an external event. |
1596 | * @brief Enable clearing the output channel on an external event. |
Line 1574... | Line 1609... | ||
1574 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1609 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1575 | * @retval None |
1610 | * @retval None |
1576 | */ |
1611 | */ |
1577 | __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1612 | __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1578 | { |
1613 | { |
1579 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1614 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1580 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1615 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1581 | SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1616 | SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1582 | } |
1617 | } |
1583 | 1618 | ||
1584 | /** |
1619 | /** |
1585 | * @brief Disable clearing the output channel on an external event. |
1620 | * @brief Disable clearing the output channel on an external event. |
Line 1597... | Line 1632... | ||
1597 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1632 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1598 | * @retval None |
1633 | * @retval None |
1599 | */ |
1634 | */ |
1600 | __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1635 | __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1601 | { |
1636 | { |
1602 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1637 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1603 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1638 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1604 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1639 | CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); |
1605 | } |
1640 | } |
1606 | 1641 | ||
1607 | /** |
1642 | /** |
1608 | * @brief Indicates clearing the output channel on an external event is enabled for the output channel. |
1643 | * @brief Indicates clearing the output channel on an external event is enabled for the output channel. |
Line 1622... | Line 1657... | ||
1622 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1657 | * @arg @ref LL_TIM_CHANNEL_CH4 |
1623 | * @retval State of bit (1 or 0). |
1658 | * @retval State of bit (1 or 0). |
1624 | */ |
1659 | */ |
1625 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1660 | __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) |
1626 | { |
1661 | { |
1627 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1662 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1628 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1663 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1629 | uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; |
1664 | uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; |
1630 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1665 | return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); |
1631 | } |
1666 | } |
1632 | 1667 | ||
1633 | /** |
1668 | /** |
1634 | * @brief Set compare value for output channel 1 (TIMx_CCR1). |
1669 | * @brief Set compare value for output channel 1 (TIMx_CCR1). |
Line 1804... | Line 1839... | ||
1804 | * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING or @ref LL_TIM_IC_POLARITY_BOTHEDGE |
1839 | * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING or @ref LL_TIM_IC_POLARITY_BOTHEDGE |
1805 | * @retval None |
1840 | * @retval None |
1806 | */ |
1841 | */ |
1807 | __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
1842 | __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) |
1808 | { |
1843 | { |
1809 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1844 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1810 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1845 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1811 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), |
1846 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), |
1812 | ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]); |
1847 | ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) \ |
- | 1848 | << SHIFT_TAB_ICxx[iChannel]); |
|
1813 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
1849 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
1814 | (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); |
1850 | (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); |
1815 | } |
1851 | } |
1816 | 1852 | ||
1817 | /** |
1853 | /** |
Line 1832... | Line 1868... | ||
1832 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
1868 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
1833 | * @retval None |
1869 | * @retval None |
1834 | */ |
1870 | */ |
1835 | __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) |
1871 | __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) |
1836 | { |
1872 | { |
1837 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1873 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1838 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1874 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1839 | MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1875 | MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1840 | } |
1876 | } |
1841 | 1877 | ||
1842 | /** |
1878 | /** |
1843 | * @brief Get the current active input. |
1879 | * @brief Get the current active input. |
Line 1856... | Line 1892... | ||
1856 | * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI |
1892 | * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI |
1857 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
1893 | * @arg @ref LL_TIM_ACTIVEINPUT_TRC |
1858 | */ |
1894 | */ |
1859 | __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) |
1895 | __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) |
1860 | { |
1896 | { |
1861 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1897 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1862 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1898 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1863 | return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
1899 | return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
1864 | } |
1900 | } |
1865 | 1901 | ||
1866 | /** |
1902 | /** |
1867 | * @brief Set the prescaler of input channel. |
1903 | * @brief Set the prescaler of input channel. |
Line 1882... | Line 1918... | ||
1882 | * @arg @ref LL_TIM_ICPSC_DIV8 |
1918 | * @arg @ref LL_TIM_ICPSC_DIV8 |
1883 | * @retval None |
1919 | * @retval None |
1884 | */ |
1920 | */ |
1885 | __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) |
1921 | __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) |
1886 | { |
1922 | { |
1887 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1923 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1888 | __IO uint32_t *pReg = (__IO 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])); |
1889 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1925 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1890 | } |
1926 | } |
1891 | 1927 | ||
1892 | /** |
1928 | /** |
1893 | * @brief Get the current prescaler value acting on an input channel. |
1929 | * @brief Get the current prescaler value acting on an input channel. |
Line 1907... | Line 1943... | ||
1907 | * @arg @ref LL_TIM_ICPSC_DIV4 |
1943 | * @arg @ref LL_TIM_ICPSC_DIV4 |
1908 | * @arg @ref LL_TIM_ICPSC_DIV8 |
1944 | * @arg @ref LL_TIM_ICPSC_DIV8 |
1909 | */ |
1945 | */ |
1910 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) |
1946 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) |
1911 | { |
1947 | { |
1912 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1948 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1913 | const __IO uint32_t *pReg = (__IO 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])); |
1914 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
1950 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
1915 | } |
1951 | } |
1916 | 1952 | ||
1917 | /** |
1953 | /** |
1918 | * @brief Set the input filter duration. |
1954 | * @brief Set the input filter duration. |
Line 1945... | Line 1981... | ||
1945 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
1981 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
1946 | * @retval None |
1982 | * @retval None |
1947 | */ |
1983 | */ |
1948 | __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) |
1984 | __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) |
1949 | { |
1985 | { |
1950 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1986 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1951 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1987 | __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1952 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1988 | MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); |
1953 | } |
1989 | } |
1954 | 1990 | ||
1955 | /** |
1991 | /** |
1956 | * @brief Get the input filter duration. |
1992 | * @brief Get the input filter duration. |
Line 1982... | Line 2018... | ||
1982 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 |
2018 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 |
1983 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
2019 | * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 |
1984 | */ |
2020 | */ |
1985 | __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) |
2021 | __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) |
1986 | { |
2022 | { |
1987 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2023 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
1988 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
2024 | const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); |
1989 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
2025 | return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); |
1990 | } |
2026 | } |
1991 | 2027 | ||
1992 | /** |
2028 | /** |
1993 | * @brief Set the input channel polarity. |
2029 | * @brief Set the input channel polarity. |
Line 2011... | Line 2047... | ||
2011 | * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE |
2047 | * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE |
2012 | * @retval None |
2048 | * @retval None |
2013 | */ |
2049 | */ |
2014 | __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) |
2050 | __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) |
2015 | { |
2051 | { |
2016 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2052 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2017 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
2053 | MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), |
2018 | ICPolarity << SHIFT_TAB_CCxP[iChannel]); |
2054 | ICPolarity << SHIFT_TAB_CCxP[iChannel]); |
2019 | } |
2055 | } |
2020 | 2056 | ||
2021 | /** |
2057 | /** |
Line 2039... | Line 2075... | ||
2039 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
2075 | * @arg @ref LL_TIM_IC_POLARITY_FALLING |
2040 | * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE |
2076 | * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE |
2041 | */ |
2077 | */ |
2042 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
2078 | __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) |
2043 | { |
2079 | { |
2044 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2080 | uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); |
2045 | return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> |
2081 | return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> |
2046 | SHIFT_TAB_CCxP[iChannel]); |
2082 | SHIFT_TAB_CCxP[iChannel]); |
2047 | } |
2083 | } |
2048 | 2084 | ||
2049 | /** |
2085 | /** |
Line 2706... | Line 2742... | ||
2706 | { |
2742 | { |
2707 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF)); |
2743 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF)); |
2708 | } |
2744 | } |
2709 | 2745 | ||
2710 | /** |
2746 | /** |
2711 | * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set (Capture/Compare 1 interrupt is pending). |
2747 | * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set |
- | 2748 | * (Capture/Compare 1 interrupt is pending). |
|
2712 | * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR |
2749 | * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR |
2713 | * @param TIMx Timer instance |
2750 | * @param TIMx Timer instance |
2714 | * @retval State of bit (1 or 0). |
2751 | * @retval State of bit (1 or 0). |
2715 | */ |
2752 | */ |
2716 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) |
2753 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) |
Line 2728... | Line 2765... | ||
2728 | { |
2765 | { |
2729 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF)); |
2766 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF)); |
2730 | } |
2767 | } |
2731 | 2768 | ||
2732 | /** |
2769 | /** |
2733 | * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set (Capture/Compare 2 over-capture interrupt is pending). |
2770 | * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set |
- | 2771 | * (Capture/Compare 2 over-capture interrupt is pending). |
|
2734 | * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR |
2772 | * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR |
2735 | * @param TIMx Timer instance |
2773 | * @param TIMx Timer instance |
2736 | * @retval State of bit (1 or 0). |
2774 | * @retval State of bit (1 or 0). |
2737 | */ |
2775 | */ |
2738 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) |
2776 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) |
Line 2750... | Line 2788... | ||
2750 | { |
2788 | { |
2751 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF)); |
2789 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF)); |
2752 | } |
2790 | } |
2753 | 2791 | ||
2754 | /** |
2792 | /** |
2755 | * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set (Capture/Compare 3 over-capture interrupt is pending). |
2793 | * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set |
- | 2794 | * (Capture/Compare 3 over-capture interrupt is pending). |
|
2756 | * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR |
2795 | * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR |
2757 | * @param TIMx Timer instance |
2796 | * @param TIMx Timer instance |
2758 | * @retval State of bit (1 or 0). |
2797 | * @retval State of bit (1 or 0). |
2759 | */ |
2798 | */ |
2760 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) |
2799 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) |
Line 2772... | Line 2811... | ||
2772 | { |
2811 | { |
2773 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF)); |
2812 | WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF)); |
2774 | } |
2813 | } |
2775 | 2814 | ||
2776 | /** |
2815 | /** |
2777 | * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set (Capture/Compare 4 over-capture interrupt is pending). |
2816 | * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set |
- | 2817 | * (Capture/Compare 4 over-capture interrupt is pending). |
|
2778 | * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR |
2818 | * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR |
2779 | * @param TIMx Timer instance |
2819 | * @param TIMx Timer instance |
2780 | * @retval State of bit (1 or 0). |
2820 | * @retval State of bit (1 or 0). |
2781 | */ |
2821 | */ |
2782 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) |
2822 | __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) |