Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
stm32f30x_tim.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f30x_tim.h 00004 * @author MCD Application Team 00005 * @version V1.2.3 00006 * @date 10-July-2015 00007 * @brief This file contains all the functions prototypes for the TIM firmware 00008 * library. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00013 * 00014 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00015 * You may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at: 00017 * 00018 * http://www.st.com/software_license_agreement_liberty_v2 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 * See the License for the specific language governing permissions and 00024 * limitations under the License. 00025 * 00026 ****************************************************************************** 00027 */ 00028 00029 /* Define to prevent recursive inclusion -------------------------------------*/ 00030 #ifndef __STM32F30x_TIM_H 00031 #define __STM32F30x_TIM_H 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /* Includes ------------------------------------------------------------------*/ 00038 #include "stm32f30x.h" 00039 00040 /** @addtogroup stm32f30x_StdPeriph_Driver 00041 * @{ 00042 */ 00043 00044 /** @addtogroup TIM 00045 * @{ 00046 */ 00047 00048 /* Exported types ------------------------------------------------------------*/ 00049 00050 /** 00051 * @brief TIM Time Base Init structure definition 00052 * @note This structure is used with all TIMx except for TIM6 and TIM7. 00053 */ 00054 00055 typedef struct 00056 { 00057 uint16_t TIM_Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. 00058 This parameter can be a number between 0x0000 and 0xFFFF */ 00059 00060 uint16_t TIM_CounterMode; /*!< Specifies the counter mode. 00061 This parameter can be a value of @ref TIM_Counter_Mode */ 00062 00063 uint32_t TIM_Period; /*!< Specifies the period value to be loaded into the active 00064 Auto-Reload Register at the next update event. 00065 This parameter must be a number between 0x0000 and 0xFFFF. */ 00066 00067 uint16_t TIM_ClockDivision; /*!< Specifies the clock division. 00068 This parameter can be a value of @ref TIM_Clock_Division_CKD */ 00069 00070 uint16_t TIM_RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter 00071 reaches zero, an update event is generated and counting restarts 00072 from the RCR value (N). 00073 This means in PWM mode that (N+1) corresponds to: 00074 - the number of PWM periods in edge-aligned mode 00075 - the number of half PWM period in center-aligned mode 00076 This parameter must be a number between 0x00 and 0xFF. 00077 @note This parameter is valid only for TIM1 and TIM8. */ 00078 } TIM_TimeBaseInitTypeDef; 00079 00080 /** 00081 * @brief TIM Output Compare Init structure definition 00082 */ 00083 00084 typedef struct 00085 { 00086 uint32_t TIM_OCMode; /*!< Specifies the TIM mode. 00087 This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */ 00088 00089 uint16_t TIM_OutputState; /*!< Specifies the TIM Output Compare state. 00090 This parameter can be a value of @ref TIM_Output_Compare_State */ 00091 00092 uint16_t TIM_OutputNState; /*!< Specifies the TIM complementary Output Compare state. 00093 This parameter can be a value of @ref TIM_Output_Compare_N_State 00094 @note This parameter is valid only for TIM1 and TIM8. */ 00095 00096 uint32_t TIM_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 00097 This parameter can be a number between 0x0000 and 0xFFFF */ 00098 00099 uint16_t TIM_OCPolarity; /*!< Specifies the output polarity. 00100 This parameter can be a value of @ref TIM_Output_Compare_Polarity */ 00101 00102 uint16_t TIM_OCNPolarity; /*!< Specifies the complementary output polarity. 00103 This parameter can be a value of @ref TIM_Output_Compare_N_Polarity 00104 @note This parameter is valid only for TIM1 and TIM8. */ 00105 00106 uint16_t TIM_OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. 00107 This parameter can be a value of @ref TIM_Output_Compare_Idle_State 00108 @note This parameter is valid only for TIM1 and TIM8. */ 00109 00110 uint16_t TIM_OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. 00111 This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State 00112 @note This parameter is valid only for TIM1 and TIM8. */ 00113 } TIM_OCInitTypeDef; 00114 00115 /** 00116 * @brief TIM Input Capture Init structure definition 00117 */ 00118 00119 typedef struct 00120 { 00121 00122 uint16_t TIM_Channel; /*!< Specifies the TIM channel. 00123 This parameter can be a value of @ref TIM_Channel */ 00124 00125 uint16_t TIM_ICPolarity; /*!< Specifies the active edge of the input signal. 00126 This parameter can be a value of @ref TIM_Input_Capture_Polarity */ 00127 00128 uint16_t TIM_ICSelection; /*!< Specifies the input. 00129 This parameter can be a value of @ref TIM_Input_Capture_Selection */ 00130 00131 uint16_t TIM_ICPrescaler; /*!< Specifies the Input Capture Prescaler. 00132 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ 00133 00134 uint16_t TIM_ICFilter; /*!< Specifies the input capture filter. 00135 This parameter can be a number between 0x0 and 0xF */ 00136 } TIM_ICInitTypeDef; 00137 00138 /** 00139 * @brief BDTR structure definition 00140 * @note This structure is used only with TIM1 and TIM8. 00141 */ 00142 00143 typedef struct 00144 { 00145 00146 uint16_t TIM_OSSRState; /*!< Specifies the Off-State selection used in Run mode. 00147 This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */ 00148 00149 uint16_t TIM_OSSIState; /*!< Specifies the Off-State used in Idle state. 00150 This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */ 00151 00152 uint16_t TIM_LOCKLevel; /*!< Specifies the LOCK level parameters. 00153 This parameter can be a value of @ref TIM_Lock_level */ 00154 00155 uint16_t TIM_DeadTime; /*!< Specifies the delay time between the switching-off and the 00156 switching-on of the outputs. 00157 This parameter can be a number between 0x00 and 0xFF */ 00158 00159 uint16_t TIM_Break; /*!< Specifies whether the TIM Break input is enabled or not. 00160 This parameter can be a value of @ref TIM_Break_Input_enable_disable */ 00161 00162 uint16_t TIM_BreakPolarity; /*!< Specifies the TIM Break Input pin polarity. 00163 This parameter can be a value of @ref TIM_Break_Polarity */ 00164 00165 uint16_t TIM_AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not. 00166 This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */ 00167 } TIM_BDTRInitTypeDef; 00168 00169 /* Exported constants --------------------------------------------------------*/ 00170 00171 /** @defgroup TIM_Exported_constants 00172 * @{ 00173 */ 00174 00175 #define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00176 ((PERIPH) == TIM2) || \ 00177 ((PERIPH) == TIM3) || \ 00178 ((PERIPH) == TIM4) || \ 00179 ((PERIPH) == TIM6) || \ 00180 ((PERIPH) == TIM7) || \ 00181 ((PERIPH) == TIM8) || \ 00182 ((PERIPH) == TIM15) || \ 00183 ((PERIPH) == TIM16) || \ 00184 ((PERIPH) == TIM17) || \ 00185 ((PERIPH) == TIM20)) 00186 00187 /* LIST1: TIM1, TIM2, TIM3, TIM4, TIM8, TIM15, TIM16, TIM20 and TIM17 */ 00188 #define IS_TIM_LIST1_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00189 ((PERIPH) == TIM2) || \ 00190 ((PERIPH) == TIM3) || \ 00191 ((PERIPH) == TIM4) || \ 00192 ((PERIPH) == TIM8) || \ 00193 ((PERIPH) == TIM15) || \ 00194 ((PERIPH) == TIM16) || \ 00195 ((PERIPH) == TIM17) || \ 00196 ((PERIPH) == TIM20)) 00197 00198 /* LIST2: TIM1, TIM2, TIM3, TIM4, TIM8, TIM20 and TIM15 */ 00199 #define IS_TIM_LIST2_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00200 ((PERIPH) == TIM2) || \ 00201 ((PERIPH) == TIM3) || \ 00202 ((PERIPH) == TIM4) || \ 00203 ((PERIPH) == TIM8) || \ 00204 ((PERIPH) == TIM15)|| \ 00205 ((PERIPH) == TIM20)) 00206 00207 /* LIST3: TIM1, TIM2, TIM3, TIM4, TIM20 and TIM8 */ 00208 #define IS_TIM_LIST3_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00209 ((PERIPH) == TIM2) || \ 00210 ((PERIPH) == TIM3) || \ 00211 ((PERIPH) == TIM4) || \ 00212 ((PERIPH) == TIM8) || \ 00213 ((PERIPH) == TIM20)) 00214 00215 /* LIST4: TIM1, TIM20 and TIM8 */ 00216 #define IS_TIM_LIST4_PERIPH(PERIPH) (((PERIPH) == TIM1) ||\ 00217 ((PERIPH) == TIM8) ||\ 00218 ((PERIPH) == TIM20)) 00219 00220 /* LIST5: TIM1, TIM2, TIM3, TIM4, TIM5, TIM6, TIM7 and TIM8 */ 00221 #define IS_TIM_LIST5_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00222 ((PERIPH) == TIM2) || \ 00223 ((PERIPH) == TIM3) || \ 00224 ((PERIPH) == TIM4) || \ 00225 ((PERIPH) == TIM6) || \ 00226 ((PERIPH) == TIM7) || \ 00227 ((PERIPH) == TIM8)) 00228 /* LIST6: TIM1, TIM8, TIM15, TIM16, TIM20 and TIM17 */ 00229 #define IS_TIM_LIST6_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00230 ((PERIPH) == TIM8) || \ 00231 ((PERIPH) == TIM15) || \ 00232 ((PERIPH) == TIM16) || \ 00233 ((PERIPH) == TIM17) || \ 00234 ((PERIPH) == TIM20)) 00235 00236 /* LIST5: TIM1, TIM2, TIM3, TIM4, TIM5, TIM6, TIM7, TIM20 and TIM8 */ 00237 #define IS_TIM_LIST7_PERIPH(PERIPH) (((PERIPH) == TIM1) || \ 00238 ((PERIPH) == TIM2) || \ 00239 ((PERIPH) == TIM3) || \ 00240 ((PERIPH) == TIM4) || \ 00241 ((PERIPH) == TIM6) || \ 00242 ((PERIPH) == TIM7) || \ 00243 ((PERIPH) == TIM8) || \ 00244 ((PERIPH) == TIM15)|| \ 00245 ((PERIPH) == TIM20)) 00246 00247 /* LIST8: TIM16 (option register) */ 00248 #define IS_TIM_LIST8_PERIPH(PERIPH) (((PERIPH) == TIM16)|| \ 00249 ((PERIPH) == TIM1) ||\ 00250 ((PERIPH) == TIM8) ||\ 00251 ((PERIPH) == TIM20)) 00252 00253 /** @defgroup TIM_Output_Compare_and_PWM_modes 00254 * @{ 00255 */ 00256 00257 #define TIM_OCMode_Timing ((uint32_t)0x00000) 00258 #define TIM_OCMode_Active ((uint32_t)0x00010) 00259 #define TIM_OCMode_Inactive ((uint32_t)0x00020) 00260 #define TIM_OCMode_Toggle ((uint32_t)0x00030) 00261 #define TIM_OCMode_PWM1 ((uint32_t)0x00060) 00262 #define TIM_OCMode_PWM2 ((uint32_t)0x00070) 00263 00264 #define TIM_OCMode_Retrigerrable_OPM1 ((uint32_t)0x10000) 00265 #define TIM_OCMode_Retrigerrable_OPM2 ((uint32_t)0x10010) 00266 #define TIM_OCMode_Combined_PWM1 ((uint32_t)0x10040) 00267 #define TIM_OCMode_Combined_PWM2 ((uint32_t)0x10050) 00268 #define TIM_OCMode_Asymmetric_PWM1 ((uint32_t)0x10060) 00269 #define TIM_OCMode_Asymmetric_PWM2 ((uint32_t)0x10070) 00270 00271 #define IS_TIM_OC_MODE(MODE) (((MODE) == TIM_OCMode_Timing) || \ 00272 ((MODE) == TIM_OCMode_Active) || \ 00273 ((MODE) == TIM_OCMode_Inactive) || \ 00274 ((MODE) == TIM_OCMode_Toggle)|| \ 00275 ((MODE) == TIM_OCMode_PWM1) || \ 00276 ((MODE) == TIM_OCMode_PWM2) || \ 00277 ((MODE) == TIM_OCMode_Retrigerrable_OPM1) || \ 00278 ((MODE) == TIM_OCMode_Retrigerrable_OPM2) || \ 00279 ((MODE) == TIM_OCMode_Combined_PWM1) || \ 00280 ((MODE) == TIM_OCMode_Combined_PWM2) || \ 00281 ((MODE) == TIM_OCMode_Asymmetric_PWM1) || \ 00282 ((MODE) == TIM_OCMode_Asymmetric_PWM2)) 00283 00284 #define IS_TIM_OCM(MODE) (((MODE) == TIM_OCMode_Timing) || \ 00285 ((MODE) == TIM_OCMode_Active) || \ 00286 ((MODE) == TIM_OCMode_Inactive) || \ 00287 ((MODE) == TIM_OCMode_Toggle)|| \ 00288 ((MODE) == TIM_OCMode_PWM1) || \ 00289 ((MODE) == TIM_OCMode_PWM2) || \ 00290 ((MODE) == TIM_ForcedAction_Active) || \ 00291 ((MODE) == TIM_ForcedAction_InActive) || \ 00292 ((MODE) == TIM_OCMode_Retrigerrable_OPM1) || \ 00293 ((MODE) == TIM_OCMode_Retrigerrable_OPM2) || \ 00294 ((MODE) == TIM_OCMode_Combined_PWM1) || \ 00295 ((MODE) == TIM_OCMode_Combined_PWM2) || \ 00296 ((MODE) == TIM_OCMode_Asymmetric_PWM1) || \ 00297 ((MODE) == TIM_OCMode_Asymmetric_PWM2)) 00298 /** 00299 * @} 00300 */ 00301 00302 /** @defgroup TIM_One_Pulse_Mode 00303 * @{ 00304 */ 00305 00306 #define TIM_OPMode_Single ((uint16_t)0x0008) 00307 #define TIM_OPMode_Repetitive ((uint16_t)0x0000) 00308 #define IS_TIM_OPM_MODE(MODE) (((MODE) == TIM_OPMode_Single) || \ 00309 ((MODE) == TIM_OPMode_Repetitive)) 00310 /** 00311 * @} 00312 */ 00313 00314 /** @defgroup TIM_Channel 00315 * @{ 00316 */ 00317 00318 #define TIM_Channel_1 ((uint16_t)0x0000) 00319 #define TIM_Channel_2 ((uint16_t)0x0004) 00320 #define TIM_Channel_3 ((uint16_t)0x0008) 00321 #define TIM_Channel_4 ((uint16_t)0x000C) 00322 #define TIM_Channel_5 ((uint16_t)0x0010) 00323 #define TIM_Channel_6 ((uint16_t)0x0014) 00324 00325 #define IS_TIM_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ 00326 ((CHANNEL) == TIM_Channel_2) || \ 00327 ((CHANNEL) == TIM_Channel_3) || \ 00328 ((CHANNEL) == TIM_Channel_4)) 00329 00330 #define IS_TIM_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ 00331 ((CHANNEL) == TIM_Channel_2)) 00332 #define IS_TIM_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \ 00333 ((CHANNEL) == TIM_Channel_2) || \ 00334 ((CHANNEL) == TIM_Channel_3)) 00335 /** 00336 * @} 00337 */ 00338 00339 /** @defgroup TIM_Clock_Division_CKD 00340 * @{ 00341 */ 00342 00343 #define TIM_CKD_DIV1 ((uint16_t)0x0000) 00344 #define TIM_CKD_DIV2 ((uint16_t)0x0100) 00345 #define TIM_CKD_DIV4 ((uint16_t)0x0200) 00346 #define IS_TIM_CKD_DIV(DIV) (((DIV) == TIM_CKD_DIV1) || \ 00347 ((DIV) == TIM_CKD_DIV2) || \ 00348 ((DIV) == TIM_CKD_DIV4)) 00349 /** 00350 * @} 00351 */ 00352 00353 /** @defgroup TIM_Counter_Mode 00354 * @{ 00355 */ 00356 00357 #define TIM_CounterMode_Up ((uint16_t)0x0000) 00358 #define TIM_CounterMode_Down ((uint16_t)0x0010) 00359 #define TIM_CounterMode_CenterAligned1 ((uint16_t)0x0020) 00360 #define TIM_CounterMode_CenterAligned2 ((uint16_t)0x0040) 00361 #define TIM_CounterMode_CenterAligned3 ((uint16_t)0x0060) 00362 #define IS_TIM_COUNTER_MODE(MODE) (((MODE) == TIM_CounterMode_Up) || \ 00363 ((MODE) == TIM_CounterMode_Down) || \ 00364 ((MODE) == TIM_CounterMode_CenterAligned1) || \ 00365 ((MODE) == TIM_CounterMode_CenterAligned2) || \ 00366 ((MODE) == TIM_CounterMode_CenterAligned3)) 00367 /** 00368 * @} 00369 */ 00370 00371 /** @defgroup TIM_Output_Compare_Polarity 00372 * @{ 00373 */ 00374 00375 #define TIM_OCPolarity_High ((uint16_t)0x0000) 00376 #define TIM_OCPolarity_Low ((uint16_t)0x0002) 00377 #define IS_TIM_OC_POLARITY(POLARITY) (((POLARITY) == TIM_OCPolarity_High) || \ 00378 ((POLARITY) == TIM_OCPolarity_Low)) 00379 /** 00380 * @} 00381 */ 00382 00383 /** @defgroup TIM_Output_Compare_N_Polarity 00384 * @{ 00385 */ 00386 00387 #define TIM_OCNPolarity_High ((uint16_t)0x0000) 00388 #define TIM_OCNPolarity_Low ((uint16_t)0x0008) 00389 #define IS_TIM_OCN_POLARITY(POLARITY) (((POLARITY) == TIM_OCNPolarity_High) || \ 00390 ((POLARITY) == TIM_OCNPolarity_Low)) 00391 /** 00392 * @} 00393 */ 00394 00395 /** @defgroup TIM_Output_Compare_State 00396 * @{ 00397 */ 00398 00399 #define TIM_OutputState_Disable ((uint16_t)0x0000) 00400 #define TIM_OutputState_Enable ((uint16_t)0x0001) 00401 #define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OutputState_Disable) || \ 00402 ((STATE) == TIM_OutputState_Enable)) 00403 /** 00404 * @} 00405 */ 00406 00407 /** @defgroup TIM_Output_Compare_N_State 00408 * @{ 00409 */ 00410 00411 #define TIM_OutputNState_Disable ((uint16_t)0x0000) 00412 #define TIM_OutputNState_Enable ((uint16_t)0x0004) 00413 #define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OutputNState_Disable) || \ 00414 ((STATE) == TIM_OutputNState_Enable)) 00415 /** 00416 * @} 00417 */ 00418 00419 /** @defgroup TIM_Capture_Compare_State 00420 * @{ 00421 */ 00422 00423 #define TIM_CCx_Enable ((uint16_t)0x0001) 00424 #define TIM_CCx_Disable ((uint16_t)0x0000) 00425 #define IS_TIM_CCX(CCX) (((CCX) == TIM_CCx_Enable) || \ 00426 ((CCX) == TIM_CCx_Disable)) 00427 /** 00428 * @} 00429 */ 00430 00431 /** @defgroup TIM_Capture_Compare_N_State 00432 * @{ 00433 */ 00434 00435 #define TIM_CCxN_Enable ((uint16_t)0x0004) 00436 #define TIM_CCxN_Disable ((uint16_t)0x0000) 00437 #define IS_TIM_CCXN(CCXN) (((CCXN) == TIM_CCxN_Enable) || \ 00438 ((CCXN) == TIM_CCxN_Disable)) 00439 /** 00440 * @} 00441 */ 00442 00443 /** @defgroup TIM_Break_Input_enable_disable 00444 * @{ 00445 */ 00446 00447 #define TIM_Break_Enable ((uint16_t)0x1000) 00448 #define TIM_Break_Disable ((uint16_t)0x0000) 00449 #define IS_TIM_BREAK_STATE(STATE) (((STATE) == TIM_Break_Enable) || \ 00450 ((STATE) == TIM_Break_Disable)) 00451 /** 00452 * @} 00453 */ 00454 00455 /** @defgroup TIM_Break1_Input_enable_disable 00456 * @{ 00457 */ 00458 00459 #define TIM_Break1_Enable ((uint32_t)0x00001000) 00460 #define TIM_Break1_Disable ((uint32_t)0x00000000) 00461 #define IS_TIM_BREAK1_STATE(STATE) (((STATE) == TIM_Break1_Enable) || \ 00462 ((STATE) == TIM_Break1_Disable)) 00463 /** 00464 * @} 00465 */ 00466 00467 /** @defgroup TIM_Break2_Input_enable_disable 00468 * @{ 00469 */ 00470 00471 #define TIM_Break2_Enable ((uint32_t)0x01000000) 00472 #define TIM_Break2_Disable ((uint32_t)0x00000000) 00473 #define IS_TIM_BREAK2_STATE(STATE) (((STATE) == TIM_Break2_Enable) || \ 00474 ((STATE) == TIM_Break2_Disable)) 00475 /** 00476 * @} 00477 */ 00478 00479 /** @defgroup TIM_Break_Polarity 00480 * @{ 00481 */ 00482 00483 #define TIM_BreakPolarity_Low ((uint16_t)0x0000) 00484 #define TIM_BreakPolarity_High ((uint16_t)0x2000) 00485 #define IS_TIM_BREAK_POLARITY(POLARITY) (((POLARITY) == TIM_BreakPolarity_Low) || \ 00486 ((POLARITY) == TIM_BreakPolarity_High)) 00487 /** 00488 * @} 00489 */ 00490 00491 /** @defgroup TIM_Break1_Polarity 00492 * @{ 00493 */ 00494 00495 #define TIM_Break1Polarity_Low ((uint32_t)0x00000000) 00496 #define TIM_Break1Polarity_High ((uint32_t)0x00002000) 00497 #define IS_TIM_BREAK1_POLARITY(POLARITY) (((POLARITY) == TIM_Break1Polarity_Low) || \ 00498 ((POLARITY) == TIM_Break1Polarity_High)) 00499 /** 00500 * @} 00501 */ 00502 00503 /** @defgroup TIM_Break2_Polarity 00504 * @{ 00505 */ 00506 00507 #define TIM_Break2Polarity_Low ((uint32_t)0x00000000) 00508 #define TIM_Break2Polarity_High ((uint32_t)0x02000000) 00509 #define IS_TIM_BREAK2_POLARITY(POLARITY) (((POLARITY) == TIM_Break2Polarity_Low) || \ 00510 ((POLARITY) == TIM_Break2Polarity_High)) 00511 /** 00512 * @} 00513 */ 00514 00515 /** @defgroup TIM_Break1_Filter 00516 * @{ 00517 */ 00518 00519 #define IS_TIM_BREAK1_FILTER(FILTER) ((FILTER) <= 0xF) 00520 /** 00521 * @} 00522 */ 00523 00524 /** @defgroup TIM_Break2_Filter 00525 * @{ 00526 */ 00527 00528 #define IS_TIM_BREAK2_FILTER(FILTER) ((FILTER) <= 0xF) 00529 /** 00530 * @} 00531 */ 00532 00533 /** @defgroup TIM_AOE_Bit_Set_Reset 00534 * @{ 00535 */ 00536 00537 #define TIM_AutomaticOutput_Enable ((uint16_t)0x4000) 00538 #define TIM_AutomaticOutput_Disable ((uint16_t)0x0000) 00539 #define IS_TIM_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TIM_AutomaticOutput_Enable) || \ 00540 ((STATE) == TIM_AutomaticOutput_Disable)) 00541 /** 00542 * @} 00543 */ 00544 00545 /** @defgroup TIM_Lock_level 00546 * @{ 00547 */ 00548 00549 #define TIM_LOCKLevel_OFF ((uint16_t)0x0000) 00550 #define TIM_LOCKLevel_1 ((uint16_t)0x0100) 00551 #define TIM_LOCKLevel_2 ((uint16_t)0x0200) 00552 #define TIM_LOCKLevel_3 ((uint16_t)0x0300) 00553 #define IS_TIM_LOCK_LEVEL(LEVEL) (((LEVEL) == TIM_LOCKLevel_OFF) || \ 00554 ((LEVEL) == TIM_LOCKLevel_1) || \ 00555 ((LEVEL) == TIM_LOCKLevel_2) || \ 00556 ((LEVEL) == TIM_LOCKLevel_3)) 00557 /** 00558 * @} 00559 */ 00560 00561 /** @defgroup TIM_OSSI_Off_State_Selection_for_Idle_mode_state 00562 * @{ 00563 */ 00564 00565 #define TIM_OSSIState_Enable ((uint16_t)0x0400) 00566 #define TIM_OSSIState_Disable ((uint16_t)0x0000) 00567 #define IS_TIM_OSSI_STATE(STATE) (((STATE) == TIM_OSSIState_Enable) || \ 00568 ((STATE) == TIM_OSSIState_Disable)) 00569 /** 00570 * @} 00571 */ 00572 00573 /** @defgroup TIM_OSSR_Off_State_Selection_for_Run_mode_state 00574 * @{ 00575 */ 00576 00577 #define TIM_OSSRState_Enable ((uint16_t)0x0800) 00578 #define TIM_OSSRState_Disable ((uint16_t)0x0000) 00579 #define IS_TIM_OSSR_STATE(STATE) (((STATE) == TIM_OSSRState_Enable) || \ 00580 ((STATE) == TIM_OSSRState_Disable)) 00581 /** 00582 * @} 00583 */ 00584 00585 /** @defgroup TIM_Output_Compare_Idle_State 00586 * @{ 00587 */ 00588 00589 #define TIM_OCIdleState_Set ((uint16_t)0x0100) 00590 #define TIM_OCIdleState_Reset ((uint16_t)0x0000) 00591 #define IS_TIM_OCIDLE_STATE(STATE) (((STATE) == TIM_OCIdleState_Set) || \ 00592 ((STATE) == TIM_OCIdleState_Reset)) 00593 /** 00594 * @} 00595 */ 00596 00597 /** @defgroup TIM_Output_Compare_N_Idle_State 00598 * @{ 00599 */ 00600 00601 #define TIM_OCNIdleState_Set ((uint16_t)0x0200) 00602 #define TIM_OCNIdleState_Reset ((uint16_t)0x0000) 00603 #define IS_TIM_OCNIDLE_STATE(STATE) (((STATE) == TIM_OCNIdleState_Set) || \ 00604 ((STATE) == TIM_OCNIdleState_Reset)) 00605 /** 00606 * @} 00607 */ 00608 00609 /** @defgroup TIM_Input_Capture_Polarity 00610 * @{ 00611 */ 00612 00613 #define TIM_ICPolarity_Rising ((uint16_t)0x0000) 00614 #define TIM_ICPolarity_Falling ((uint16_t)0x0002) 00615 #define TIM_ICPolarity_BothEdge ((uint16_t)0x000A) 00616 #define IS_TIM_IC_POLARITY(POLARITY) (((POLARITY) == TIM_ICPolarity_Rising) || \ 00617 ((POLARITY) == TIM_ICPolarity_Falling)|| \ 00618 ((POLARITY) == TIM_ICPolarity_BothEdge)) 00619 /** 00620 * @} 00621 */ 00622 00623 /** @defgroup TIM_Input_Capture_Selection 00624 * @{ 00625 */ 00626 00627 #define TIM_ICSelection_DirectTI ((uint16_t)0x0001) /*!< TIM Input 1, 2, 3 or 4 is selected to be 00628 connected to IC1, IC2, IC3 or IC4, respectively */ 00629 #define TIM_ICSelection_IndirectTI ((uint16_t)0x0002) /*!< TIM Input 1, 2, 3 or 4 is selected to be 00630 connected to IC2, IC1, IC4 or IC3, respectively. */ 00631 #define TIM_ICSelection_TRC ((uint16_t)0x0003) /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC. */ 00632 #define IS_TIM_IC_SELECTION(SELECTION) (((SELECTION) == TIM_ICSelection_DirectTI) || \ 00633 ((SELECTION) == TIM_ICSelection_IndirectTI) || \ 00634 ((SELECTION) == TIM_ICSelection_TRC)) 00635 /** 00636 * @} 00637 */ 00638 00639 /** @defgroup TIM_Input_Capture_Prescaler 00640 * @{ 00641 */ 00642 00643 #define TIM_ICPSC_DIV1 ((uint16_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input. */ 00644 #define TIM_ICPSC_DIV2 ((uint16_t)0x0004) /*!< Capture performed once every 2 events. */ 00645 #define TIM_ICPSC_DIV4 ((uint16_t)0x0008) /*!< Capture performed once every 4 events. */ 00646 #define TIM_ICPSC_DIV8 ((uint16_t)0x000C) /*!< Capture performed once every 8 events. */ 00647 #define IS_TIM_IC_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ICPSC_DIV1) || \ 00648 ((PRESCALER) == TIM_ICPSC_DIV2) || \ 00649 ((PRESCALER) == TIM_ICPSC_DIV4) || \ 00650 ((PRESCALER) == TIM_ICPSC_DIV8)) 00651 /** 00652 * @} 00653 */ 00654 00655 /** @defgroup TIM_interrupt_sources 00656 * @{ 00657 */ 00658 00659 #define TIM_IT_Update ((uint16_t)0x0001) 00660 #define TIM_IT_CC1 ((uint16_t)0x0002) 00661 #define TIM_IT_CC2 ((uint16_t)0x0004) 00662 #define TIM_IT_CC3 ((uint16_t)0x0008) 00663 #define TIM_IT_CC4 ((uint16_t)0x0010) 00664 #define TIM_IT_COM ((uint16_t)0x0020) 00665 #define TIM_IT_Trigger ((uint16_t)0x0040) 00666 #define TIM_IT_Break ((uint16_t)0x0080) 00667 #define IS_TIM_IT(IT) ((((IT) & (uint16_t)0xFF00) == 0x0000) && ((IT) != 0x0000)) 00668 00669 #define IS_TIM_GET_IT(IT) (((IT) == TIM_IT_Update) || \ 00670 ((IT) == TIM_IT_CC1) || \ 00671 ((IT) == TIM_IT_CC2) || \ 00672 ((IT) == TIM_IT_CC3) || \ 00673 ((IT) == TIM_IT_CC4) || \ 00674 ((IT) == TIM_IT_COM) || \ 00675 ((IT) == TIM_IT_Trigger) || \ 00676 ((IT) == TIM_IT_Break)) 00677 /** 00678 * @} 00679 */ 00680 00681 /** @defgroup TIM_DMA_Base_address 00682 * @{ 00683 */ 00684 00685 #define TIM_DMABase_CR1 ((uint16_t)0x0000) 00686 #define TIM_DMABase_CR2 ((uint16_t)0x0001) 00687 #define TIM_DMABase_SMCR ((uint16_t)0x0002) 00688 #define TIM_DMABase_DIER ((uint16_t)0x0003) 00689 #define TIM_DMABase_SR ((uint16_t)0x0004) 00690 #define TIM_DMABase_EGR ((uint16_t)0x0005) 00691 #define TIM_DMABase_CCMR1 ((uint16_t)0x0006) 00692 #define TIM_DMABase_CCMR2 ((uint16_t)0x0007) 00693 #define TIM_DMABase_CCER ((uint16_t)0x0008) 00694 #define TIM_DMABase_CNT ((uint16_t)0x0009) 00695 #define TIM_DMABase_PSC ((uint16_t)0x000A) 00696 #define TIM_DMABase_ARR ((uint16_t)0x000B) 00697 #define TIM_DMABase_RCR ((uint16_t)0x000C) 00698 #define TIM_DMABase_CCR1 ((uint16_t)0x000D) 00699 #define TIM_DMABase_CCR2 ((uint16_t)0x000E) 00700 #define TIM_DMABase_CCR3 ((uint16_t)0x000F) 00701 #define TIM_DMABase_CCR4 ((uint16_t)0x0010) 00702 #define TIM_DMABase_BDTR ((uint16_t)0x0011) 00703 #define TIM_DMABase_DCR ((uint16_t)0x0012) 00704 #define TIM_DMABase_OR ((uint16_t)0x0013) 00705 #define TIM_DMABase_CCMR3 ((uint16_t)0x0014) 00706 #define TIM_DMABase_CCR5 ((uint16_t)0x0015) 00707 #define TIM_DMABase_CCR6 ((uint16_t)0x0016) 00708 #define IS_TIM_DMA_BASE(BASE) (((BASE) == TIM_DMABase_CR1) || \ 00709 ((BASE) == TIM_DMABase_CR2) || \ 00710 ((BASE) == TIM_DMABase_SMCR) || \ 00711 ((BASE) == TIM_DMABase_DIER) || \ 00712 ((BASE) == TIM_DMABase_SR) || \ 00713 ((BASE) == TIM_DMABase_EGR) || \ 00714 ((BASE) == TIM_DMABase_CCMR1) || \ 00715 ((BASE) == TIM_DMABase_CCMR2) || \ 00716 ((BASE) == TIM_DMABase_CCER) || \ 00717 ((BASE) == TIM_DMABase_CNT) || \ 00718 ((BASE) == TIM_DMABase_PSC) || \ 00719 ((BASE) == TIM_DMABase_ARR) || \ 00720 ((BASE) == TIM_DMABase_RCR) || \ 00721 ((BASE) == TIM_DMABase_CCR1) || \ 00722 ((BASE) == TIM_DMABase_CCR2) || \ 00723 ((BASE) == TIM_DMABase_CCR3) || \ 00724 ((BASE) == TIM_DMABase_CCR4) || \ 00725 ((BASE) == TIM_DMABase_BDTR) || \ 00726 ((BASE) == TIM_DMABase_DCR) || \ 00727 ((BASE) == TIM_DMABase_OR) || \ 00728 ((BASE) == TIM_DMABase_CCMR3) || \ 00729 ((BASE) == TIM_DMABase_CCR5) || \ 00730 ((BASE) == TIM_DMABase_CCR6)) 00731 /** 00732 * @} 00733 */ 00734 00735 /** @defgroup TIM_DMA_Burst_Length 00736 * @{ 00737 */ 00738 00739 #define TIM_DMABurstLength_1Transfer ((uint16_t)0x0000) 00740 #define TIM_DMABurstLength_2Transfers ((uint16_t)0x0100) 00741 #define TIM_DMABurstLength_3Transfers ((uint16_t)0x0200) 00742 #define TIM_DMABurstLength_4Transfers ((uint16_t)0x0300) 00743 #define TIM_DMABurstLength_5Transfers ((uint16_t)0x0400) 00744 #define TIM_DMABurstLength_6Transfers ((uint16_t)0x0500) 00745 #define TIM_DMABurstLength_7Transfers ((uint16_t)0x0600) 00746 #define TIM_DMABurstLength_8Transfers ((uint16_t)0x0700) 00747 #define TIM_DMABurstLength_9Transfers ((uint16_t)0x0800) 00748 #define TIM_DMABurstLength_10Transfers ((uint16_t)0x0900) 00749 #define TIM_DMABurstLength_11Transfers ((uint16_t)0x0A00) 00750 #define TIM_DMABurstLength_12Transfers ((uint16_t)0x0B00) 00751 #define TIM_DMABurstLength_13Transfers ((uint16_t)0x0C00) 00752 #define TIM_DMABurstLength_14Transfers ((uint16_t)0x0D00) 00753 #define TIM_DMABurstLength_15Transfers ((uint16_t)0x0E00) 00754 #define TIM_DMABurstLength_16Transfers ((uint16_t)0x0F00) 00755 #define TIM_DMABurstLength_17Transfers ((uint16_t)0x1000) 00756 #define TIM_DMABurstLength_18Transfers ((uint16_t)0x1100) 00757 #define IS_TIM_DMA_LENGTH(LENGTH) (((LENGTH) == TIM_DMABurstLength_1Transfer) || \ 00758 ((LENGTH) == TIM_DMABurstLength_2Transfers) || \ 00759 ((LENGTH) == TIM_DMABurstLength_3Transfers) || \ 00760 ((LENGTH) == TIM_DMABurstLength_4Transfers) || \ 00761 ((LENGTH) == TIM_DMABurstLength_5Transfers) || \ 00762 ((LENGTH) == TIM_DMABurstLength_6Transfers) || \ 00763 ((LENGTH) == TIM_DMABurstLength_7Transfers) || \ 00764 ((LENGTH) == TIM_DMABurstLength_8Transfers) || \ 00765 ((LENGTH) == TIM_DMABurstLength_9Transfers) || \ 00766 ((LENGTH) == TIM_DMABurstLength_10Transfers) || \ 00767 ((LENGTH) == TIM_DMABurstLength_11Transfers) || \ 00768 ((LENGTH) == TIM_DMABurstLength_12Transfers) || \ 00769 ((LENGTH) == TIM_DMABurstLength_13Transfers) || \ 00770 ((LENGTH) == TIM_DMABurstLength_14Transfers) || \ 00771 ((LENGTH) == TIM_DMABurstLength_15Transfers) || \ 00772 ((LENGTH) == TIM_DMABurstLength_16Transfers) || \ 00773 ((LENGTH) == TIM_DMABurstLength_17Transfers) || \ 00774 ((LENGTH) == TIM_DMABurstLength_18Transfers)) 00775 /** 00776 * @} 00777 */ 00778 00779 /** @defgroup TIM_DMA_sources 00780 * @{ 00781 */ 00782 00783 #define TIM_DMA_Update ((uint16_t)0x0100) 00784 #define TIM_DMA_CC1 ((uint16_t)0x0200) 00785 #define TIM_DMA_CC2 ((uint16_t)0x0400) 00786 #define TIM_DMA_CC3 ((uint16_t)0x0800) 00787 #define TIM_DMA_CC4 ((uint16_t)0x1000) 00788 #define TIM_DMA_COM ((uint16_t)0x2000) 00789 #define TIM_DMA_Trigger ((uint16_t)0x4000) 00790 #define IS_TIM_DMA_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0x80FF) == 0x0000) && ((SOURCE) != 0x0000)) 00791 00792 /** 00793 * @} 00794 */ 00795 00796 /** @defgroup TIM_External_Trigger_Prescaler 00797 * @{ 00798 */ 00799 00800 #define TIM_ExtTRGPSC_OFF ((uint16_t)0x0000) 00801 #define TIM_ExtTRGPSC_DIV2 ((uint16_t)0x1000) 00802 #define TIM_ExtTRGPSC_DIV4 ((uint16_t)0x2000) 00803 #define TIM_ExtTRGPSC_DIV8 ((uint16_t)0x3000) 00804 #define IS_TIM_EXT_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ExtTRGPSC_OFF) || \ 00805 ((PRESCALER) == TIM_ExtTRGPSC_DIV2) || \ 00806 ((PRESCALER) == TIM_ExtTRGPSC_DIV4) || \ 00807 ((PRESCALER) == TIM_ExtTRGPSC_DIV8)) 00808 /** 00809 * @} 00810 */ 00811 00812 /** @defgroup TIM_Internal_Trigger_Selection 00813 * @{ 00814 */ 00815 00816 #define TIM_TS_ITR0 ((uint16_t)0x0000) 00817 #define TIM_TS_ITR1 ((uint16_t)0x0010) 00818 #define TIM_TS_ITR2 ((uint16_t)0x0020) 00819 #define TIM_TS_ITR3 ((uint16_t)0x0030) 00820 #define TIM_TS_TI1F_ED ((uint16_t)0x0040) 00821 #define TIM_TS_TI1FP1 ((uint16_t)0x0050) 00822 #define TIM_TS_TI2FP2 ((uint16_t)0x0060) 00823 #define TIM_TS_ETRF ((uint16_t)0x0070) 00824 #define IS_TIM_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \ 00825 ((SELECTION) == TIM_TS_ITR1) || \ 00826 ((SELECTION) == TIM_TS_ITR2) || \ 00827 ((SELECTION) == TIM_TS_ITR3) || \ 00828 ((SELECTION) == TIM_TS_TI1F_ED) || \ 00829 ((SELECTION) == TIM_TS_TI1FP1) || \ 00830 ((SELECTION) == TIM_TS_TI2FP2) || \ 00831 ((SELECTION) == TIM_TS_ETRF)) 00832 #define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \ 00833 ((SELECTION) == TIM_TS_ITR1) || \ 00834 ((SELECTION) == TIM_TS_ITR2) || \ 00835 ((SELECTION) == TIM_TS_ITR3)) 00836 /** 00837 * @} 00838 */ 00839 00840 /** @defgroup TIM_TIx_External_Clock_Source 00841 * @{ 00842 */ 00843 00844 #define TIM_TIxExternalCLK1Source_TI1 ((uint16_t)0x0050) 00845 #define TIM_TIxExternalCLK1Source_TI2 ((uint16_t)0x0060) 00846 #define TIM_TIxExternalCLK1Source_TI1ED ((uint16_t)0x0040) 00847 00848 /** 00849 * @} 00850 */ 00851 00852 /** @defgroup TIM_External_Trigger_Polarity 00853 * @{ 00854 */ 00855 #define TIM_ExtTRGPolarity_Inverted ((uint16_t)0x8000) 00856 #define TIM_ExtTRGPolarity_NonInverted ((uint16_t)0x0000) 00857 #define IS_TIM_EXT_POLARITY(POLARITY) (((POLARITY) == TIM_ExtTRGPolarity_Inverted) || \ 00858 ((POLARITY) == TIM_ExtTRGPolarity_NonInverted)) 00859 /** 00860 * @} 00861 */ 00862 00863 /** @defgroup TIM_Prescaler_Reload_Mode 00864 * @{ 00865 */ 00866 00867 #define TIM_PSCReloadMode_Update ((uint16_t)0x0000) 00868 #define TIM_PSCReloadMode_Immediate ((uint16_t)0x0001) 00869 #define IS_TIM_PRESCALER_RELOAD(RELOAD) (((RELOAD) == TIM_PSCReloadMode_Update) || \ 00870 ((RELOAD) == TIM_PSCReloadMode_Immediate)) 00871 /** 00872 * @} 00873 */ 00874 00875 /** @defgroup TIM_Forced_Action 00876 * @{ 00877 */ 00878 00879 #define TIM_ForcedAction_Active ((uint16_t)0x0050) 00880 #define TIM_ForcedAction_InActive ((uint16_t)0x0040) 00881 #define IS_TIM_FORCED_ACTION(ACTION) (((ACTION) == TIM_ForcedAction_Active) || \ 00882 ((ACTION) == TIM_ForcedAction_InActive)) 00883 /** 00884 * @} 00885 */ 00886 00887 /** @defgroup TIM_Encoder_Mode 00888 * @{ 00889 */ 00890 00891 #define TIM_EncoderMode_TI1 ((uint16_t)0x0001) 00892 #define TIM_EncoderMode_TI2 ((uint16_t)0x0002) 00893 #define TIM_EncoderMode_TI12 ((uint16_t)0x0003) 00894 #define IS_TIM_ENCODER_MODE(MODE) (((MODE) == TIM_EncoderMode_TI1) || \ 00895 ((MODE) == TIM_EncoderMode_TI2) || \ 00896 ((MODE) == TIM_EncoderMode_TI12)) 00897 /** 00898 * @} 00899 */ 00900 00901 00902 /** @defgroup TIM_Event_Source 00903 * @{ 00904 */ 00905 00906 #define TIM_EventSource_Update ((uint16_t)0x0001) 00907 #define TIM_EventSource_CC1 ((uint16_t)0x0002) 00908 #define TIM_EventSource_CC2 ((uint16_t)0x0004) 00909 #define TIM_EventSource_CC3 ((uint16_t)0x0008) 00910 #define TIM_EventSource_CC4 ((uint16_t)0x0010) 00911 #define TIM_EventSource_COM ((uint16_t)0x0020) 00912 #define TIM_EventSource_Trigger ((uint16_t)0x0040) 00913 #define TIM_EventSource_Break ((uint16_t)0x0080) 00914 #define TIM_EventSource_Break2 ((uint16_t)0x0100) 00915 #define IS_TIM_EVENT_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0xFE00) == 0x0000) && ((SOURCE) != 0x0000)) 00916 00917 /** 00918 * @} 00919 */ 00920 00921 /** @defgroup TIM_Update_Source 00922 * @{ 00923 */ 00924 00925 #define TIM_UpdateSource_Global ((uint16_t)0x0000) /*!< Source of update is the counter overflow/underflow 00926 or the setting of UG bit, or an update generation 00927 through the slave mode controller. */ 00928 #define TIM_UpdateSource_Regular ((uint16_t)0x0001) /*!< Source of update is counter overflow/underflow. */ 00929 #define IS_TIM_UPDATE_SOURCE(SOURCE) (((SOURCE) == TIM_UpdateSource_Global) || \ 00930 ((SOURCE) == TIM_UpdateSource_Regular)) 00931 /** 00932 * @} 00933 */ 00934 00935 /** @defgroup TIM_Output_Compare_Preload_State 00936 * @{ 00937 */ 00938 00939 #define TIM_OCPreload_Enable ((uint16_t)0x0008) 00940 #define TIM_OCPreload_Disable ((uint16_t)0x0000) 00941 #define IS_TIM_OCPRELOAD_STATE(STATE) (((STATE) == TIM_OCPreload_Enable) || \ 00942 ((STATE) == TIM_OCPreload_Disable)) 00943 /** 00944 * @} 00945 */ 00946 00947 /** @defgroup TIM_Output_Compare_Fast_State 00948 * @{ 00949 */ 00950 00951 #define TIM_OCFast_Enable ((uint16_t)0x0004) 00952 #define TIM_OCFast_Disable ((uint16_t)0x0000) 00953 #define IS_TIM_OCFAST_STATE(STATE) (((STATE) == TIM_OCFast_Enable) || \ 00954 ((STATE) == TIM_OCFast_Disable)) 00955 00956 /** 00957 * @} 00958 */ 00959 00960 /** @defgroup TIM_Output_Compare_Clear_State 00961 * @{ 00962 */ 00963 00964 #define TIM_OCClear_Enable ((uint16_t)0x0080) 00965 #define TIM_OCClear_Disable ((uint16_t)0x0000) 00966 #define IS_TIM_OCCLEAR_STATE(STATE) (((STATE) == TIM_OCClear_Enable) || \ 00967 ((STATE) == TIM_OCClear_Disable)) 00968 /** 00969 * @} 00970 */ 00971 00972 /** @defgroup TIM_Trigger_Output_Source 00973 * @{ 00974 */ 00975 00976 #define TIM_TRGOSource_Reset ((uint16_t)0x0000) 00977 #define TIM_TRGOSource_Enable ((uint16_t)0x0010) 00978 #define TIM_TRGOSource_Update ((uint16_t)0x0020) 00979 #define TIM_TRGOSource_OC1 ((uint16_t)0x0030) 00980 #define TIM_TRGOSource_OC1Ref ((uint16_t)0x0040) 00981 #define TIM_TRGOSource_OC2Ref ((uint16_t)0x0050) 00982 #define TIM_TRGOSource_OC3Ref ((uint16_t)0x0060) 00983 #define TIM_TRGOSource_OC4Ref ((uint16_t)0x0070) 00984 #define IS_TIM_TRGO_SOURCE(SOURCE) (((SOURCE) == TIM_TRGOSource_Reset) || \ 00985 ((SOURCE) == TIM_TRGOSource_Enable) || \ 00986 ((SOURCE) == TIM_TRGOSource_Update) || \ 00987 ((SOURCE) == TIM_TRGOSource_OC1) || \ 00988 ((SOURCE) == TIM_TRGOSource_OC1Ref) || \ 00989 ((SOURCE) == TIM_TRGOSource_OC2Ref) || \ 00990 ((SOURCE) == TIM_TRGOSource_OC3Ref) || \ 00991 ((SOURCE) == TIM_TRGOSource_OC4Ref)) 00992 00993 00994 #define TIM_TRGO2Source_Reset ((uint32_t)0x00000000) 00995 #define TIM_TRGO2Source_Enable ((uint32_t)0x00100000) 00996 #define TIM_TRGO2Source_Update ((uint32_t)0x00200000) 00997 #define TIM_TRGO2Source_OC1 ((uint32_t)0x00300000) 00998 #define TIM_TRGO2Source_OC1Ref ((uint32_t)0x00400000) 00999 #define TIM_TRGO2Source_OC2Ref ((uint32_t)0x00500000) 01000 #define TIM_TRGO2Source_OC3Ref ((uint32_t)0x00600000) 01001 #define TIM_TRGO2Source_OC4Ref ((uint32_t)0x00700000) 01002 #define TIM_TRGO2Source_OC5Ref ((uint32_t)0x00800000) 01003 #define TIM_TRGO2Source_OC6Ref ((uint32_t)0x00900000) 01004 #define TIM_TRGO2Source_OC4Ref_RisingFalling ((uint32_t)0x00A00000) 01005 #define TIM_TRGO2Source_OC6Ref_RisingFalling ((uint32_t)0x00B00000) 01006 #define TIM_TRGO2Source_OC4RefRising_OC6RefRising ((uint32_t)0x00C00000) 01007 #define TIM_TRGO2Source_OC4RefRising_OC6RefFalling ((uint32_t)0x00D00000) 01008 #define TIM_TRGO2Source_OC5RefRising_OC6RefRising ((uint32_t)0x00E00000) 01009 #define TIM_TRGO2Source_OC5RefRising_OC6RefFalling ((uint32_t)0x00F00000) 01010 #define IS_TIM_TRGO2_SOURCE(SOURCE) (((SOURCE) == TIM_TRGO2Source_Reset) || \ 01011 ((SOURCE) == TIM_TRGO2Source_Enable) || \ 01012 ((SOURCE) == TIM_TRGO2Source_Update) || \ 01013 ((SOURCE) == TIM_TRGO2Source_OC1) || \ 01014 ((SOURCE) == TIM_TRGO2Source_OC1Ref) || \ 01015 ((SOURCE) == TIM_TRGO2Source_OC2Ref) || \ 01016 ((SOURCE) == TIM_TRGO2Source_OC3Ref) || \ 01017 ((SOURCE) == TIM_TRGO2Source_OC4Ref) || \ 01018 ((SOURCE) == TIM_TRGO2Source_OC5Ref) || \ 01019 ((SOURCE) == TIM_TRGO2Source_OC6Ref) || \ 01020 ((SOURCE) == TIM_TRGO2Source_OC4Ref_RisingFalling) || \ 01021 ((SOURCE) == TIM_TRGO2Source_OC6Ref_RisingFalling) || \ 01022 ((SOURCE) == TIM_TRGO2Source_OC4RefRising_OC6RefRising) || \ 01023 ((SOURCE) == TIM_TRGO2Source_OC4RefRising_OC6RefFalling) || \ 01024 ((SOURCE) == TIM_TRGO2Source_OC5RefRising_OC6RefRising) || \ 01025 ((SOURCE) == TIM_TRGO2Source_OC5RefRising_OC6RefFalling)) 01026 /** 01027 * @} 01028 */ 01029 01030 /** @defgroup TIM_Slave_Mode 01031 * @{ 01032 */ 01033 01034 #define TIM_SlaveMode_Reset ((uint32_t)0x00004) 01035 #define TIM_SlaveMode_Gated ((uint32_t)0x00005) 01036 #define TIM_SlaveMode_Trigger ((uint32_t)0x00006) 01037 #define TIM_SlaveMode_External1 ((uint32_t)0x00007) 01038 #define TIM_SlaveMode_Combined_ResetTrigger ((uint32_t)0x10000) 01039 #define IS_TIM_SLAVE_MODE(MODE) (((MODE) == TIM_SlaveMode_Reset) || \ 01040 ((MODE) == TIM_SlaveMode_Gated) || \ 01041 ((MODE) == TIM_SlaveMode_Trigger) || \ 01042 ((MODE) == TIM_SlaveMode_External1) || \ 01043 ((MODE) == TIM_SlaveMode_Combined_ResetTrigger)) 01044 /** 01045 * @} 01046 */ 01047 01048 /** @defgroup TIM_Master_Slave_Mode 01049 * @{ 01050 */ 01051 01052 #define TIM_MasterSlaveMode_Enable ((uint16_t)0x0080) 01053 #define TIM_MasterSlaveMode_Disable ((uint16_t)0x0000) 01054 #define IS_TIM_MSM_STATE(STATE) (((STATE) == TIM_MasterSlaveMode_Enable) || \ 01055 ((STATE) == TIM_MasterSlaveMode_Disable)) 01056 /** 01057 * @} 01058 */ 01059 /** @defgroup TIM_Remap 01060 * @{ 01061 */ 01062 #define TIM16_GPIO ((uint16_t)0x0000) 01063 #define TIM16_RTC_CLK ((uint16_t)0x0001) 01064 #define TIM16_HSEDiv32 ((uint16_t)0x0002) 01065 #define TIM16_MCO ((uint16_t)0x0003) 01066 01067 #define TIM1_ADC1_AWDG1 ((uint16_t)0x0001) 01068 #define TIM1_ADC1_AWDG2 ((uint16_t)0x0002) 01069 #define TIM1_ADC1_AWDG3 ((uint16_t)0x0003) 01070 #define TIM1_ADC4_AWDG1 ((uint16_t)0x0004) 01071 #define TIM1_ADC4_AWDG2 ((uint16_t)0x0008) 01072 #define TIM1_ADC4_AWDG3 ((uint16_t)0x000C) 01073 01074 #define TIM8_ADC2_AWDG1 ((uint16_t)0x0001) 01075 #define TIM8_ADC2_AWDG2 ((uint16_t)0x0002) 01076 #define TIM8_ADC2_AWDG3 ((uint16_t)0x0003) 01077 #define TIM8_ADC3_AWDG1 ((uint16_t)0x0004) 01078 #define TIM8_ADC3_AWDG2 ((uint16_t)0x0008) 01079 #define TIM8_ADC3_AWDG3 ((uint16_t)0x000C) 01080 01081 #define TIM20_ADC3_AWDG1 ((uint16_t)0x0001) 01082 #define TIM20_ADC3_AWDG2 ((uint16_t)0x0002) 01083 #define TIM20_ADC3_AWDG3 ((uint16_t)0x0003) 01084 #define TIM20_ADC4_AWDG1 ((uint16_t)0x0004) 01085 #define TIM20_ADC4_AWDG2 ((uint16_t)0x0008) 01086 #define TIM20_ADC4_AWDG3 ((uint16_t)0x000C) 01087 01088 #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM16_GPIO)|| \ 01089 ((TIM_REMAP) == TIM16_RTC_CLK) || \ 01090 ((TIM_REMAP) == TIM16_HSEDiv32) || \ 01091 ((TIM_REMAP) == TIM16_MCO) ||\ 01092 ((TIM_REMAP) == TIM1_ADC1_AWDG1) ||\ 01093 ((TIM_REMAP) == TIM1_ADC1_AWDG2) ||\ 01094 ((TIM_REMAP) == TIM1_ADC1_AWDG3) ||\ 01095 ((TIM_REMAP) == TIM1_ADC4_AWDG1) ||\ 01096 ((TIM_REMAP) == TIM1_ADC4_AWDG2) ||\ 01097 ((TIM_REMAP) == TIM1_ADC4_AWDG3) ||\ 01098 ((TIM_REMAP) == TIM8_ADC2_AWDG1) ||\ 01099 ((TIM_REMAP) == TIM8_ADC2_AWDG2) ||\ 01100 ((TIM_REMAP) == TIM8_ADC2_AWDG3) ||\ 01101 ((TIM_REMAP) == TIM8_ADC3_AWDG1) ||\ 01102 ((TIM_REMAP) == TIM8_ADC3_AWDG2) ||\ 01103 ((TIM_REMAP) == TIM8_ADC3_AWDG3) ||\ 01104 ((TIM_REMAP) == TIM20_ADC3_AWDG1)||\ 01105 ((TIM_REMAP) == TIM20_ADC3_AWDG2)||\ 01106 ((TIM_REMAP) == TIM20_ADC3_AWDG3)||\ 01107 ((TIM_REMAP) == TIM20_ADC4_AWDG1)||\ 01108 ((TIM_REMAP) == TIM20_ADC4_AWDG2)||\ 01109 ((TIM_REMAP) == TIM20_ADC4_AWDG3)) 01110 01111 /** 01112 * @} 01113 */ 01114 /** @defgroup TIM_Flags 01115 * @{ 01116 */ 01117 01118 #define TIM_FLAG_Update ((uint32_t)0x00001) 01119 #define TIM_FLAG_CC1 ((uint32_t)0x00002) 01120 #define TIM_FLAG_CC2 ((uint32_t)0x00004) 01121 #define TIM_FLAG_CC3 ((uint32_t)0x00008) 01122 #define TIM_FLAG_CC4 ((uint32_t)0x00010) 01123 #define TIM_FLAG_COM ((uint32_t)0x00020) 01124 #define TIM_FLAG_Trigger ((uint32_t)0x00040) 01125 #define TIM_FLAG_Break ((uint32_t)0x00080) 01126 #define TIM_FLAG_Break2 ((uint32_t)0x00100) 01127 #define TIM_FLAG_CC1OF ((uint32_t)0x00200) 01128 #define TIM_FLAG_CC2OF ((uint32_t)0x00400) 01129 #define TIM_FLAG_CC3OF ((uint32_t)0x00800) 01130 #define TIM_FLAG_CC4OF ((uint32_t)0x01000) 01131 #define TIM_FLAG_CC5 ((uint32_t)0x10000) 01132 #define TIM_FLAG_CC6 ((uint32_t)0x20000) 01133 #define IS_TIM_GET_FLAG(FLAG) (((FLAG) == TIM_FLAG_Update) || \ 01134 ((FLAG) == TIM_FLAG_CC1) || \ 01135 ((FLAG) == TIM_FLAG_CC2) || \ 01136 ((FLAG) == TIM_FLAG_CC3) || \ 01137 ((FLAG) == TIM_FLAG_CC4) || \ 01138 ((FLAG) == TIM_FLAG_COM) || \ 01139 ((FLAG) == TIM_FLAG_Trigger) || \ 01140 ((FLAG) == TIM_FLAG_Break) || \ 01141 ((FLAG) == TIM_FLAG_Break2) || \ 01142 ((FLAG) == TIM_FLAG_CC1OF) || \ 01143 ((FLAG) == TIM_FLAG_CC2OF) || \ 01144 ((FLAG) == TIM_FLAG_CC3OF) || \ 01145 ((FLAG) == TIM_FLAG_CC4OF) ||\ 01146 ((FLAG) == TIM_FLAG_CC5) ||\ 01147 ((FLAG) == TIM_FLAG_CC6)) 01148 01149 #define IS_TIM_CLEAR_FLAG(TIM_FLAG) ((((TIM_FLAG) & (uint32_t)0xE000) == 0x0000) && ((TIM_FLAG) != 0x0000)) 01150 /** 01151 * @} 01152 */ 01153 01154 /** @defgroup TIM_OCReferenceClear 01155 * @{ 01156 */ 01157 #define TIM_OCReferenceClear_ETRF ((uint16_t)0x0008) 01158 #define TIM_OCReferenceClear_OCREFCLR ((uint16_t)0x0000) 01159 #define TIM_OCREFERENCECECLEAR_SOURCE(SOURCE) (((SOURCE) == TIM_OCReferenceClear_ETRF) || \ 01160 ((SOURCE) == TIM_OCReferenceClear_OCREFCLR)) 01161 01162 /** @defgroup TIM_Input_Capture_Filer_Value 01163 * @{ 01164 */ 01165 01166 #define IS_TIM_IC_FILTER(ICFILTER) ((ICFILTER) <= 0xF) 01167 /** 01168 * @} 01169 */ 01170 01171 /** @defgroup TIM_External_Trigger_Filter 01172 * @{ 01173 */ 01174 01175 #define IS_TIM_EXT_FILTER(EXTFILTER) ((EXTFILTER) <= 0xF) 01176 /** 01177 * @} 01178 */ 01179 01180 /** @defgroup TIM_Legacy 01181 * @{ 01182 */ 01183 01184 #define TIM_DMABurstLength_1Byte TIM_DMABurstLength_1Transfer 01185 #define TIM_DMABurstLength_2Bytes TIM_DMABurstLength_2Transfers 01186 #define TIM_DMABurstLength_3Bytes TIM_DMABurstLength_3Transfers 01187 #define TIM_DMABurstLength_4Bytes TIM_DMABurstLength_4Transfers 01188 #define TIM_DMABurstLength_5Bytes TIM_DMABurstLength_5Transfers 01189 #define TIM_DMABurstLength_6Bytes TIM_DMABurstLength_6Transfers 01190 #define TIM_DMABurstLength_7Bytes TIM_DMABurstLength_7Transfers 01191 #define TIM_DMABurstLength_8Bytes TIM_DMABurstLength_8Transfers 01192 #define TIM_DMABurstLength_9Bytes TIM_DMABurstLength_9Transfers 01193 #define TIM_DMABurstLength_10Bytes TIM_DMABurstLength_10Transfers 01194 #define TIM_DMABurstLength_11Bytes TIM_DMABurstLength_11Transfers 01195 #define TIM_DMABurstLength_12Bytes TIM_DMABurstLength_12Transfers 01196 #define TIM_DMABurstLength_13Bytes TIM_DMABurstLength_13Transfers 01197 #define TIM_DMABurstLength_14Bytes TIM_DMABurstLength_14Transfers 01198 #define TIM_DMABurstLength_15Bytes TIM_DMABurstLength_15Transfers 01199 #define TIM_DMABurstLength_16Bytes TIM_DMABurstLength_16Transfers 01200 #define TIM_DMABurstLength_17Bytes TIM_DMABurstLength_17Transfers 01201 #define TIM_DMABurstLength_18Bytes TIM_DMABurstLength_18Transfers 01202 /** 01203 * @} 01204 */ 01205 01206 /** 01207 * @} 01208 */ 01209 01210 /* Exported macro ------------------------------------------------------------*/ 01211 /* Exported functions --------------------------------------------------------*/ 01212 01213 /* TimeBase management ********************************************************/ 01214 void TIM_DeInit(TIM_TypeDef* TIMx); 01215 void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); 01216 void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); 01217 void TIM_PrescalerConfig(TIM_TypeDef* TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode); 01218 void TIM_CounterModeConfig(TIM_TypeDef* TIMx, uint16_t TIM_CounterMode); 01219 void TIM_SetCounter(TIM_TypeDef* TIMx, uint32_t Counter); 01220 void TIM_SetAutoreload(TIM_TypeDef* TIMx, uint32_t Autoreload); 01221 uint32_t TIM_GetCounter(TIM_TypeDef* TIMx); 01222 uint16_t TIM_GetPrescaler(TIM_TypeDef* TIMx); 01223 void TIM_UpdateDisableConfig(TIM_TypeDef* TIMx, FunctionalState NewState); 01224 void TIM_UpdateRequestConfig(TIM_TypeDef* TIMx, uint16_t TIM_UpdateSource); 01225 void TIM_UIFRemap(TIM_TypeDef* TIMx, FunctionalState NewState); 01226 void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState NewState); 01227 void TIM_SelectOnePulseMode(TIM_TypeDef* TIMx, uint16_t TIM_OPMode); 01228 void TIM_SetClockDivision(TIM_TypeDef* TIMx, uint16_t TIM_CKD); 01229 void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); 01230 01231 /* Output Compare management **************************************************/ 01232 void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01233 void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01234 void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01235 void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01236 void TIM_OC5Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01237 void TIM_OC6Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); 01238 void TIM_SelectGC5C1(TIM_TypeDef* TIMx, FunctionalState NewState); 01239 void TIM_SelectGC5C2(TIM_TypeDef* TIMx, FunctionalState NewState); 01240 void TIM_SelectGC5C3(TIM_TypeDef* TIMx, FunctionalState NewState); 01241 void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct); 01242 void TIM_SelectOCxM(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint32_t TIM_OCMode); 01243 void TIM_SetCompare1(TIM_TypeDef* TIMx, uint32_t Compare1); 01244 void TIM_SetCompare2(TIM_TypeDef* TIMx, uint32_t Compare2); 01245 void TIM_SetCompare3(TIM_TypeDef* TIMx, uint32_t Compare3); 01246 void TIM_SetCompare4(TIM_TypeDef* TIMx, uint32_t Compare4); 01247 void TIM_SetCompare5(TIM_TypeDef* TIMx, uint32_t Compare5); 01248 void TIM_SetCompare6(TIM_TypeDef* TIMx, uint32_t Compare6); 01249 void TIM_ForcedOC1Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01250 void TIM_ForcedOC2Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01251 void TIM_ForcedOC3Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01252 void TIM_ForcedOC4Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01253 void TIM_ForcedOC5Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01254 void TIM_ForcedOC6Config(TIM_TypeDef* TIMx, uint16_t TIM_ForcedAction); 01255 void TIM_OC1PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01256 void TIM_OC2PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01257 void TIM_OC3PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01258 void TIM_OC4PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01259 void TIM_OC5PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01260 void TIM_OC6PreloadConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPreload); 01261 void TIM_OC1FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); 01262 void TIM_OC2FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); 01263 void TIM_OC3FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); 01264 void TIM_OC4FastConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCFast); 01265 void TIM_ClearOC1Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01266 void TIM_ClearOC2Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01267 void TIM_ClearOC3Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01268 void TIM_ClearOC4Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01269 void TIM_ClearOC5Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01270 void TIM_ClearOC6Ref(TIM_TypeDef* TIMx, uint16_t TIM_OCClear); 01271 void TIM_SelectOCREFClear(TIM_TypeDef* TIMx, uint16_t TIM_OCReferenceClear); 01272 void TIM_OC1PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01273 void TIM_OC1NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); 01274 void TIM_OC2PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01275 void TIM_OC2NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); 01276 void TIM_OC3PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01277 void TIM_OC3NPolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCNPolarity); 01278 void TIM_OC4PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01279 void TIM_OC5PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01280 void TIM_OC6PolarityConfig(TIM_TypeDef* TIMx, uint16_t TIM_OCPolarity); 01281 void TIM_CCxCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx); 01282 void TIM_CCxNCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN); 01283 01284 /* Input Capture management ***************************************************/ 01285 void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct); 01286 void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct); 01287 void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct); 01288 uint32_t TIM_GetCapture1(TIM_TypeDef* TIMx); 01289 uint32_t TIM_GetCapture2(TIM_TypeDef* TIMx); 01290 uint32_t TIM_GetCapture3(TIM_TypeDef* TIMx); 01291 uint32_t TIM_GetCapture4(TIM_TypeDef* TIMx); 01292 void TIM_SetIC1Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); 01293 void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); 01294 void TIM_SetIC3Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); 01295 void TIM_SetIC4Prescaler(TIM_TypeDef* TIMx, uint16_t TIM_ICPSC); 01296 01297 /* Advanced-control timers (TIM1 and TIM8) specific features ******************/ 01298 void TIM_BDTRConfig(TIM_TypeDef* TIMx, TIM_BDTRInitTypeDef *TIM_BDTRInitStruct); 01299 void TIM_Break1Config(TIM_TypeDef* TIMx, uint32_t TIM_Break1Polarity, uint8_t TIM_Break1Filter); 01300 void TIM_Break2Config(TIM_TypeDef* TIMx, uint32_t TIM_Break2Polarity, uint8_t TIM_Break2Filter); 01301 void TIM_Break1Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); 01302 void TIM_Break2Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); 01303 void TIM_BDTRStructInit(TIM_BDTRInitTypeDef* TIM_BDTRInitStruct); 01304 void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState); 01305 void TIM_SelectCOM(TIM_TypeDef* TIMx, FunctionalState NewState); 01306 void TIM_CCPreloadControl(TIM_TypeDef* TIMx, FunctionalState NewState); 01307 01308 /* Interrupts, DMA and flags management ***************************************/ 01309 void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState); 01310 void TIM_GenerateEvent(TIM_TypeDef* TIMx, uint16_t TIM_EventSource); 01311 FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, uint32_t TIM_FLAG); 01312 void TIM_ClearFlag(TIM_TypeDef* TIMx, uint16_t TIM_FLAG); 01313 ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t TIM_IT); 01314 void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, uint16_t TIM_IT); 01315 void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength); 01316 void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState); 01317 void TIM_SelectCCDMA(TIM_TypeDef* TIMx, FunctionalState NewState); 01318 01319 /* Clocks management **********************************************************/ 01320 void TIM_InternalClockConfig(TIM_TypeDef* TIMx); 01321 void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); 01322 void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_TIxExternalCLKSource, 01323 uint16_t TIM_ICPolarity, uint16_t ICFilter); 01324 void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, 01325 uint16_t ExtTRGFilter); 01326 void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, 01327 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter); 01328 01329 /* Synchronization management *************************************************/ 01330 void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource); 01331 void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_TRGOSource); 01332 void TIM_SelectOutputTrigger2(TIM_TypeDef* TIMx, uint32_t TIM_TRGO2Source); 01333 void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint32_t TIM_SlaveMode); 01334 void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_MasterSlaveMode); 01335 void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, 01336 uint16_t ExtTRGFilter); 01337 01338 /* Specific interface management **********************************************/ 01339 void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, uint16_t TIM_EncoderMode, 01340 uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity); 01341 void TIM_SelectHallSensor(TIM_TypeDef* TIMx, FunctionalState NewState); 01342 01343 /* Specific remapping management **********************************************/ 01344 void TIM_RemapConfig(TIM_TypeDef* TIMx, uint16_t TIM_Remap); 01345 01346 #ifdef __cplusplus 01347 } 01348 #endif 01349 01350 #endif /*__STM32F30x_TIM_H */ 01351 01352 /** 01353 * @} 01354 */ 01355 01356 /** 01357 * @} 01358 */ 01359 01360 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 17:34:44 by
